Java SSM框架

SpringBoot部分知识
基础
自动配置原理

pom.xml:

spring-boot-dependencies:核心依赖在父工程中
引入SpringBoot依赖时,不需要指定版本,就是因为有这些版本仓库
启动器:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

就是SpringBoot的启动场景
会自动帮我们导入该模块的所有依赖
启动类:

@SpringBootApplication:标注这个类是一个SpringBoot应用
两个核心注解:
@SpringBootConfiguration:SpringBoot的配置
@Configuration:Spring配置类
@Component:说明这也是一个Spring的组件
@EnableAutoConfiguration:自动配置
@AutoConfigurationPackage:自动导入包
@Import(AutoConfigurationPackages.Registrar.class):导入选择器
metadata:源数据
@Import(EnableAutoConfigurationImportSelector.class):自动配置导入选择
AutoConfigurationImportSelector:
List configurations = getCandidateConfigurations(annotationMetadata,attributes);//获取所有的配置

protected List<String> getCandidateConfigurations(AnnotationMetadata metadata,
		AnnotationAttributes attributes) {
	List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
			getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
	Assert.notEmpty(configurations,
			"No auto configuration classes found in META-INF/spring.factories. If you "
					+ "are using a custom packaging, make sure that file is correct.");
	return configurations;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值