SpringBoot @SpringBootApplication

1、Spring Boot made configuring Spring easier with its auto-configuration feature.
2、We use @SpringBootApplication annotation to mark the main class of a Spring Boot application

@SpringBootApplication
class VehicleFactoryApplication {

    public static void main(String[] args) {
        SpringApplication.run(VehicleFactoryApplication.class, args);
    }
}

3、@SpringBootApplication encapsulates(封装) @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes.

1、Use the @ComponentScan annotation along with the @Configuration annotation to specify the packages that we want to be scanned.
Further Reading : Spring Component Scanning
2、Use the @EnableAutoConfiguration annotation along with the @Configuration annotation means that Spring Boot looks for auto-configuration beans on its classpath and automatically applies them.


4. Create a Custom Auto-Configuration with Spring Boot

你可能感兴趣的:(框架,spring,boot,java,spring)