1.spring boot 自动装配原理
开箱即用:
在开发过程中通过amven 项目的pom中添加相关依赖包,通过注解代替xml配置管理对象的生命周期
约定大于配置:
由spring boot本身来配置目标结构,由开发者在结构中添加信息的软件设计范式
spring mvc 需要配置web.xml, spring-web.xml
spring-boot start parent
spring boot decencies 作为父工程,存放了spring boot的核心依赖,不需要我们自己配置
@springbootapplication时一个组合注解,由以下注解组成
@SpringBootConfiguration//核心
@EnableAutoConfiguration//核心
@ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
@Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })
@SpringBootConfiguration 其实就携带了一个@Configuration 注解
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Configuration
public @interface Sp