我已经在 Java 类中创建了这样的配置文件,
@Profile(value = "cache")
public class MapCache {
....
}
当使用 spring.profiles.active 时,这些配置文件不会被激活,但如果我使用 spring.profiles.include 配置文件工作正常。
我想通过在 application.properties 中添加的属性激活配置文件
注意:应用程序在独立的 jetty 实例中运行。
任何提示都会很棒。
最佳答案
要通过注释激活配置文件,您需要 @ActiveProfile("profileName")
。 @Profile
注释用于将对象标记为配置文件的成员。
关于java - spring.profiles.active 在 spring boot 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64812810/