目录
配置
总结
配置
Springboot中支持三种格式的配置文件:
![](https://img-blog.csdnimg.cn/direct/fc80297aa58841658d8138d66355daf2.png)
其中,优先级最高的是application.properties,优先级第二高的是application.yml,优先级最低的是application.yaml。
注意
![](https://img-blog.csdnimg.cn/direct/c4567af2123241deb9bc64212d672004.png)
Springboot除了支持配置文件属性配置,还支持Java系统属性和命令行参数的方式进行属性配置
![](https://img-blog.csdnimg.cn/direct/bf7b95a217fe45ceb37686b501775e3d.png)
![](https://img-blog.csdnimg.cn/direct/0be62b3ad5c046e58683b74b68a46962.png)
![](https://img-blog.csdnimg.cn/direct/1af262e3840a421db9f2bb936c4bbd8c.png)
其中命令行参数的优先级要高于java系统属性,而java系统属性的优先级又高于三种配置文件
如果项目以及打包,通过下面的方式来指定java系统属性或命令行参数
![](https://img-blog.csdnimg.cn/direct/d366c09bceab4b9785e233f6a6aee848.png)
![](https://img-blog.csdnimg.cn/direct/232cce890a874530b9a5d45af4cd932a.png)
总结
![](https://img-blog.csdnimg.cn/direct/b26bd4823a7846bda8ab35ee19ed7746.png)