在Spring-boot中设置默认的活动配置文件 [英] Setting the default active profile in Spring-boot
本文介绍了在Spring-boot中设置默认的活动配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果未设置-Dspring.profiles.active
,我希望我的默认活动配置文件为production
.
I want my default active profile to be production
if -Dspring.profiles.active
is not set.
我在application.properties
中尝试了以下操作,但没有用:
I tried the following in my application.properties
but it did't work:
spring.profiles.default=production
Spring-boot版本= 1.3.5.RELEASE
Spring-boot version = 1.3.5.RELEASE
推荐答案
您在这里所做的是设置默认的 default 配置文件(如果未指定,该配置文件将在任何bean上使用@Profile
注释)为production
.
What you are doing here is setting the default default profile (the profile that is used on any bean if you don't specify the @Profile
annotation) to be production
.
您实际需要做的是设置默认的活动配置文件,如下所示:
What you actually need to do is set the default active profile, which is done like this:
spring.profiles.active=production
这篇关于在Spring-boot中设置默认的活动配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文