- 命令行参数(最高优先级)
java -jar app.jar --server.port=9000
- Java系统属性
java -Dserver.port=9000 -jar app.jar
-
操作系统环境变量
-
配置文件优先级(从高到低)
file:./config/application-{profile}.yml
file:./config/application.yml
file:./application-{profile}.yml
file:./application.yml
classpath:/config/application-{profile}.yml
classpath:/config/application.yml
classpath:/application-{profile}.yml
classpath:/application.yml
回复