SpringBoot指定外部环境配置

nohup java -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -jar /usr/local/xxxx.jar --spring.profiles.active=prod > system.log 2>&1 &

--spring.profiles.active=prod修改的是多环境配置中内部application.properties里的spring.profiles.active值

-Dspring.config.location指定的是要使用的配置文件的位置

在同级目录下没有指定的情况下,外部配置优先于内部

如果将配置文件放到其他地方

java -Dspring.config.location=F:\spring-boot-3\boot3-01-demo\application.properties -jar F:\spring-boot-3\boot3-01-demo\target\boo3-01-demo-1.0-SNAPSHOT.jar

java -Dfile.encoding=UTF-8 -Dspring.config.location=F:\spring-boot-3\boot3-01-demo\application.properties -jar F:\spring-boot-3\boot3-01-demo\target\boo3-01-demo-1.0-SNAPSHOT.jar

相关推荐
__万波__1 分钟前
二十三种设计模式(十五)--访问者模式
java·设计模式·访问者模式
吾日三省Java8 分钟前
SpringBoot整合Canal:实现MySQL数据实时同步的终极解决方案
spring boot·系统架构
fanruitian8 分钟前
SpringBoot 集成retrofit httpclient
java·spring boot·retrofit
talenteddriver11 分钟前
web: jwt令牌构成、创建的基本流程及原理
java·开发语言·python·网络协议·web
码农水水12 分钟前
宇树科技Java被问:数据库连接池的工作原理
java·数据库·后端·oracle
Seven9712 分钟前
回溯算法总结
java
小鸡脚来咯12 分钟前
软链接的作用和用途
java·ide·eclipse
这周也會开心12 分钟前
双栈实现队列以及双队列实现栈
java·开发语言
思成Codes15 分钟前
Go语言的多返回值是如何实现的?
开发语言·后端·golang
风象南17 分钟前
除了 ELK、Loki,你还应该知道的日志收集方式:Syslog
后端