spring-boot:run启动时,如何带设置环境参数dev,test.
2024-09-03 07:24:39
这边在linux 启动springboot的jar包时候,多次报错 最终使用
java -jar -Dspring.profiles.active=test demo-0.0.1-SNAPSHOT.jar的方式成功
Maven启动指定Profile通过-P,如mvn spring-boot:run -Ptest
,但这是Maven的Profile。
如果要指定spring-boot的spring.profiles.active
,spring-boot 1.x 使用mvn spring-boot:run -Drun.profiles=test
,spring-boot 2.x 使用mvn spring-boot:run -Dspring-boot.run.profiles=test
。参考资料:https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/maven-plugin/examples/run-profiles.html
如果使用命令行直接运行jar文件,则使用java -jar -Dspring.profiles.active=test demo-0.0.1-SNAPSHOT.jar
如果使用开发工具,运行Application.java文件启动
,则增加参数--spring.profiles.active=test
最新文章
- begin
- MongoDB安装及添加到Windows服务,随系统启动
- jmeter 与 java http
- mysql中替换字符串(正则) 模糊
- -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
- 2016-2017 ACM-ICPC, NEERC, Southern Subregional Contest (Online Mirror, ACM-ICPC Rules, Teams Preferred) 几道简单题的题解
- 1009 FatMouse' Trade
- org
- maven是什么?(转自oracle官网)
- 让IE支持CSS3 Media Query实现响应式Web设计
- Global.asax文件的说明
- css selector: xpath:
- java中 try return finally return(转)
- Visual studio code快捷键
- NET应用——使用RSA构建相对安全的数据交互
- 通过javap终极理解++i和i++的区别
- SQLServer数据事务日志操作
- bzoj5110: [CodePlus2017]Yazid 的新生舞会
- 高德地图添加marker及反地理编码获取POI
- ZOJ2067 经典 DP(单调队列优化)