首页 > 代码库 > @SpringBootApplication

@SpringBootApplication

1. spring 文档说明

Many Spring Boot developers always have their main class annotated with @Configuration, @EnableAutoConfiguration and @ComponentScan. Since these annotations are so frequently used together (especially if you follow the best practices above), Spring Boot provides a convenient @SpringBootApplication alternative.

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes。

@SpringBootApplication是 @Configuration, @EnableAutoConfiguration and @ComponentScan 的组合。

使用时一般写明要扫描的包 @SpringBootApplication(scanBasePackages="com.example")

 

stereotype annotations 构造型注解

@SpringBootApplication