自动配置
各种autoconfigure后缀的和其他依赖。主要是指含有spring.factories的文件。
注意,要使用@EnableAutoConfiguration注解才能启用这些依赖。
起步依赖
起步依赖就是各种starter,例如
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
starter内部时一些依赖,包括各种autoconfigure依赖和其他依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.1.6.RELEASE</version>
<scope>compile</scope>
</dependency>
一般而言具体的版本配置由spring-boot-dependencies确定。
<dependencyManagement>
<dependencies>
<!-- spring deps -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
简单来说,每个依赖就是一盘菜,starter就是一个套餐,比如烤鸭和他的饼和蘸酱,而spring-boot-dependencies是一个口味精调过的套餐集合,保证这个套餐的每一个,都适合某个口味的食客。