![](/img/trans.png)
[英]configure maven profiles in spring boot @activeprofile annotation
[英]How to configure spring profiles in Netbeans?
我在Netbeans 9.0 中运行Spring boot Java 应用程序,它有两个配置文件(测试、生产)。 我需要在“测试”配置文件而不是“默认”配置文件中运行项目
我尝试了以下设置
设置 1
项目(右键单击)> 属性> 运行> 参数
-Dspring.profiles.active=test
设置 2
项目(右键单击)> 属性> 操作> 运行项目> 激活配置文件
test
配置无法正常工作,我收到以下消息
“没有设置活动配置文件,回退到默认配置文件:默认”
你能帮我设置这个配置吗
经过一番探索,我发现从 Netbeans 8.1 及更高版本开始,您可以执行以下操作来设置 Spring 配置文件:
右键单击您的应用程序 -> 运行 Maven -> 目标 -> 在“属性”部分设置:
-Dspring.profiles.active={your profile name here}
这对我有用。
您是否尝试过在 Spring Boot 应用application.yml
的application.properties
或application.yml
中配置配置文件?
请阅读此文档Spring Boot Profiles
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.