bootstarp.yml先于application.yml加载;(因此可在bootstarp.yml中配置application需要用到的数据)
boostarp.yml配置的是系统引导性配置;
如系统的版本及说明
application:
version: 1.0.0 #版本号
copyright: #版权
如远程git配置
spring:
profiles: dev #默认配置文件 application-dev.yml
cloud:
config:
server:
default-application-name: #默认应用程序名
git:
uri: https://github.com/LSPGY/-.git #项目git地址
search-paths: config-repo/{application},config-repo/common #路径匹配 后续学习中继续了解
username:
password:
application.yml后加载,但优先级高于bootstrap.yml;可在application.yml中覆盖application配置(个人理解,真实性有待去实践确认)
bootstarp.yml具有非常低的优先级
这段摘自官网,其中but note that these do not contain any data from bootstrap.yml并不理解,有大佬看到可在评论区解释一下,谢谢
Because of the ordering rules of property sources the “bootstrap” entries take precedence, but note that these do not contain any data from bootstrap.yml, which has very low precedence, but can be used to set defaults
.
application.yml配置各种集成框架或组件的配置 如 mybatis、缓存、线程池、security、Robbie等;自定义数据配置 如设置密码最大错误次数、用户账号锁定时间等