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

相关推荐
越来越无动于衷7 分钟前
手写tomcat:基本功能实现(3)
java·tomcat
Uranus^9 分钟前
使用Spring Boot和Spring Security构建安全的RESTful API
java·spring boot·spring security·jwt·restful api
qq_5432485210 分钟前
Tomcat的调优
java·tomcat
Mcworld85716 分钟前
String的一些固定程序函数
java
越来越无动于衷16 分钟前
手写tomcat:基本功能实现(4)
java·tomcat
编程乐学(Arfan开发工程师)17 分钟前
06、基础入门-SpringBoot-依赖管理特性
android·spring boot·后端
编程乐学(Arfan开发工程师)18 分钟前
05、基础入门-SpringBoot-HelloWorld
java·spring boot·后端
小智学长 | 嵌入式18 分钟前
进阶-数据结构部分:2、常用排序算法
java·数据结构·算法
拾贰_C20 分钟前
【SpringBoot】关于MP使用中配置了数据库表前缀的问题
数据库·spring boot·oracle
保利九里43 分钟前
java中的包机制
java·开发语言