Running a Spring Boot application

So far, we have a bare bones project. There isn't much code. However, creates a single Application class; let's look at that first:

package learningspringboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

public class Application {

    public static void main(String[] args) {, args);

Let's break this down:

  • @ComponentScan: This tells Spring to look for classes with @Component, @Configuration, @Repository, @Service, and @Controller and wire them into the app context as beans. By ...

Get Learning Spring Boot now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.