springboot配置优先级

1.命令⾏参数
2.java:comp/env ⾥的 JNDI 属性
3.JVM 系统属性
4.操作系统环境变量
5.RandomValuePropertySource 属性类⽣成的 random.* 属性
6.应⽤以外的 application.properties(或 yml) ⽂件
7.打包在应⽤内的 application.properties(或 yml) ⽂件
8.在应⽤ @Configuration 配置类中, ⽤ @PropertySource 注解声明的属性⽂件
9.SpringApplication.setDefaultProperties 声明的默认属性

Author

Yunzilla

Posted on

2022-05-17

Updated on

2022-05-17

Licensed under

Comments