- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>2.1.6.RELEASE</version>
- <relativePath>../../spring-boot-dependencies</relativePath>
- </parent>
springboot 的版本管理器
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-*</artifactId>
- </dependency>
springboot 的启动器, 可以帮助导入相关的依赖
- @SpringBootApplication //springboot 的主程序注解
- // 该注解又由以下注解构成
- @Target(ElementType.TYPE)
- @Retention(RetentionPolicy.RUNTIME)
- @Documented
- @Inherited
- @SpringBootConfiguration
- @EnableAutoConfiguration
- @ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
- @Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })
- public @interface SpringBootApplication {
- @SpringBootConfiguration // 这是一个 springboot 的配置类
- @configuration // 配置类也是容器中的一个组件
- @EnableAutoConfiguration // 开启自动配置
- // 该注解内有以下注解
- @AutoConfigurationPackage
- // 将主配置类下的所有的包都扫描到容器中
- @Import(AutoConfigurationImportSelector.class)
- @AutoConfigurationPackage // 自动配置包
- @Import(AutoConfigurationPackages.Registrar.class)
spring 中底层的注解 @Import, 给容器中导入一个组件
来源: http://www.bubuko.com/infodetail-3128637.html