原文地址:https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/htmlsingle/#using-boot


继承 spring-boot-starter-parent

当我们在 pom 里面继承 spring-boot-starter-parent 的时候,我们将自动的获得一些默认值,这些默认值都是 spring-boot-starter-parent 里面默认配置的;

一般都有下面默认值:

  • JDK8 将作为默认的编译器;
  • 所有的编码,都将自动的使用 UTF8

还有一些其他默认值,博主初学,暂时也不明白是什么意思,贴出原文,大家自己看看:

A Dependency Management section, inherited from the spring-boot-dependencies pom, that manages the versions of common dependencies. This dependency management lets you omit <version> tags for those dependencies when used in your own pom.

An execution of the repackage goal with a repackage execution id. Sensible resource filtering.

Sensible plugin configuration (exec plugin, Git commit ID, and shade).

Sensible resource filtering for application.properties and application.yml including profile-specific files (for example, application-dev.properties and application-dev.yml)

Note that, since the application.properties and application.yml files accept Spring style placeholders (${…​}), the Maven filtering is changed to use @..@ placeholders. (You can override that by setting a Maven property called resource.delimiter.)


覆盖默认配置

继承默认配置以后,还是可以覆盖掉默认配置的;

我们只需要在 <properties> 里面配置,我们想要覆盖的属性的具体版本,即可:

例如,覆盖 spring-data-releasetrain 的默认版本:

<properties>
<spring-data-releasetrain.version>Fowler-SR2</spring-data-releasetrain.version>
</properties>

和上一篇,使用没有 <parent>pom,而使用 spring-boot-dependencies 一样,都可以覆盖默认配置;


启动器

启动器,可以理解为一组配置,被打包成一个依赖包了;

比如我们需要 Spring Framework 框架的缓存功能,则可以在 <dependencies> 里面添加 spring-boot-starter-cache 启动器 依赖;

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

官方的启动器名字格式都是 spring-boot-starter-* ,在 IDEA 配置好 Maven 以后,可以使用 Ctrl + 空格键 进行智能提示;

官网给出了启动器的列表,以及说明,地址 :Spring Boot 启动器

(三)Spring Boot 官网文档学习之默认配置的更多相关文章

  1. (四)Spring Boot官网文档学习

    文章目录 关于默认包的问题 加载启动类 配置 Bean管理和依赖注入 @SpringBootApplication Developer Tools 关于 Developer Tools 的一些细节 原 ...

  2. (五)Spring Boot官网文档学习

    文章目录 SpringApplication SpringApplication 事件 `ApplicationContext ` 类型 访问传递给 `SpringApplication` 的参数 A ...

  3. (二)Spring Boot 官网文档学习之入门

    文章目录 Spring Boot 是什么 系统要求 Servlet 容器 Maven方式安装Spring Boot 编写第一个 Spring Boot 项目 原文:https://docs.sprin ...

  4. Spring Security 官网文档学习

    文章目录 通过`maven`向普通的`WEB`项目中引入`spring security` 配置 `spring security` `configure(HttpSecurity)` 方法 自定义U ...

  5. Spring3.0官网文档学习笔记(四)--3.1~3.2.3

    3.1 Spring IoC容器与Beans简单介绍     BeanFactory接口提供对随意对象的配置:     ApplicationContext是BeanFactory的子接口.整合了Sp ...

  6. Spring3.0官网文档学习笔记(八)--3.4.3~3.4.6

    3.4.3 使用depends-on     使用depends-on能够强制使一个或多个beans先初始化,之后再对这个bean进行初始化. 多个bean之间用","." ...

  7. Spring3.0官网文档学习笔记(一)

    Part 1 Spring框架概述 Spring是模块化的,在应用中仅仅须要引入你所须要用到的模块的jar包,其余的jar包不用引入. spring框架支持声明式的事务管理,通过RMI或web ser ...

  8. Spring3.0官网文档学习笔记(七)--3.4.2

    3.4.2 依赖与配置的细节     3.4.2.1  Straight values (primitives, Strings, and so on)     JavaBeans PropertyE ...

  9. Spring3.0官网文档学习笔记(二)

    1.3 使用场景 典型的成熟的spring web应用 spring使用第三方框架作为中间层 远程使用场景 EJB包装 1.3.1 依赖管理.命名规则(包)     spring-*.jar *号代表 ...

随机推荐

  1. 深度学习面试题16:小卷积核级联卷积VS大卷积核卷积

    目录 感受野 多个小卷积核连续卷积和单个大卷积核卷积的作用相同 小卷积核的优势 参考资料 感受野 在卷积神经网络中,感受野(Receptive Field)的定义是卷积神经网络每一层输出的特征图(fe ...

  2. React Hooks介绍和环境搭建(一)

    React Hooks 简介 2018年底FaceBook的React小组推出Hooks以来,所有的React的开发者都对它大为赞赏.React Hooks就是用函数的形式代替原来的继承类的形式,并且 ...

  3. 与 ES5 相比,React 的 ES6 语法有何不同?

    以下语法是 ES5 与 ES6 中的区别: 1.require 与 import // ES5 var React = require('react'); // ES6 import React fr ...

  4. log4j实现日志自动清理功能

    log4j不支持自动清理功能,但是log4j2版本支持,log4j2是log4j的升级版,比logback先进. log4j升级为log4j2(不需要改动代码)https://blog.csdn.ne ...

  5. SQLServer系统视图sysobjects中type字段说明

    SQLServer中系统视图sysobjects中type字段的对象类型: AF = 聚合函数 (CLR) C = CHECK 约束 D = DEFAULT(约束或独立) F = FOREIGN KE ...

  6. 重装Mac系统

    首先介绍重装macos的一些重要事项: 重装系统之前需要弄清楚本机上安装的系统版本. 重装系统是需要管理员账户的. 获取系统镜像有多种方式,其中最常见的方式是从appstore中获取,但要注意的是要确 ...

  7. Qt tableview加载数据

    Qt tableview加载数据 //把数据加载到tableView void ImportData::loadDataInTableView() { ) { if (pageNum>stude ...

  8. docker安装并运行mysql

    docker拉取mysql镜像: [mall@VM_0_7_centos ~]$ sudo docker pull mysql:5.7 5.7: Pulling from library/mysql ...

  9. linux普通用户添加root权限

    新增一个普通用户并进入该用户: [root@VM_0_7_centos ~]# groupadd mall [root@VM_0_7_centos ~]# useradd mall -m -d /ho ...

  10. 前端速查手册——Note

    目录 自定义弹框(模块框) HTML5新增标签 HTML5新增属性 自定义弹框(模块框) HTML <div style="display:none" id="mo ...