首页 > 编程语言 > 详细

springboot基础(随笔)

时间:2019-07-20 00:44:16      阅读:106      评论:0      收藏:0      [点我收藏+]

<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,给容器中导入一个组件

技术分享图片

 

 

 

springboot基础(随笔)

原文:https://www.cnblogs.com/lovestart/p/11216014.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!