跳转至
阅读量:

自动配置原理

Spring Boot 自动配置原理解析

<!-- 跟踪父工程 -->
<!-- pom.xml -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<!-- spring-boot-starter-parent-2.3.2.RELEASE.pom -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.3.2.RELEASE</version>
</parent>

<!-- spring-boot-dependencies-2.3.2.RELEASE.pom -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>

最终在 spring-boot-dependencies 下发现了所有依赖以及其对应的版本号:

<properties>
    <activemq.version>5.15.13</activemq.version>
    <antlr2.version>2.7.7</antlr2.version>
    ......
</properties>

因此在Spring Boot的项目中,核心依赖在父工程中已经配好,我们只需要调用即可.

评论