【问题标题】:One of Spring profiles is not actived despite adding it in environment variable尽管将其中一个 Spring 配置文件添加到环境变量中,但它没有被激活
【发布时间】:2021-10-05 13:54:48
【问题描述】:

我在激活其中一个 Spring 配置文件时遇到问题。我尝试将其添加为 VM 选项、环境变量,但没有成功。 奇怪的是,所有其他配置文件都正常工作。

我尝试使用以下方法列出活动的个人资料:

for (String profileName : environment.getActiveProfiles()) {
            System.out.println("Currently active profile - " + profileName)
}    

我尝试启用的功能显示为“''”。

这是我的 VM 选项 (Intellij) 和应用程序运行时列出的配置文件。 我的应用程序中有使用 @Profile("inappreports) 注释的类。 谁知道是什么原因?

【问题讨论】:

    标签: java spring profile


    【解决方案1】:

    原来问题是由覆盖环境变量的 WildFly 配置引起的。

    【讨论】:

      猜你喜欢
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-30
      • 1970-01-01
      • 2017-05-05
      • 2014-03-06
      • 2020-04-07
      相关资源
      最近更新 更多