Spring Boot的自动配置

时间:2021-06-02 17:50:55   收藏:0   阅读:0

Spring Boot的特点

1.依赖管理

父项目做依赖管理

<!-- HelloWorld项目的父项目 -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.11.RELEASE</version>
  </parent>
  
<!-- 父项目的父项目 -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.3.11.RELEASE</version>
  </parent>

spring-boot-dependencies中几乎声明了所有我们开发时要用到依赖的版本号,今后我们用到它管理的依赖可以不用写版本号,由这个父项目自动仲裁版本号。

2.场景启动器starter

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter</artifactId>
  <version>2.3.4.RELEASE</version>
  <scope>compile</scope>
</dependency>
<!-- 在当前项目里重新配置,key要与spring-boot-dependencies保持一致 -->
<properties>
	<mysql.version>5.3.33</mysql.version>
<properties>

3.自动配置

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!