启动依赖和自动配置。
1、 启动依赖:传统的spring开发,需要自己手动的导入maven坐标,这样一是配置麻烦,二是版本若控制的不好,容易出现jar包冲突。而我们都知道,基础的springBoot开发,只需在pom中引入
<!-- 继承父包 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.3.RELEASE</version>
<relativePath></relativePath>
</parent>
<!-- spring-boot的web启动的jar包 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
这是因为,导入的依赖,已经将一些基础的jar包或插件进行了打包
2.自动配置。
springboot启动类会有@SpringBootApplication注解,点开注解发现有配置类,自动配置,自动扫描包这三个注解
再点开@EnableAutoConfiguration
会加载spring.factores
spring.factores里全是一些配置类,会自动加载这些配置。