假设我有一个@Configuration
类,甚至还有一个@ConfigurationProperties
类。
我希望从特定的application-x.properties
文件中加载配置。
我该怎么做? (无需定义新的Spring配置文件)
答案 0 :(得分:1)
您必须使用@PropertySources
,例如:@PropertySource("classpath:foo.properties")
。
选中此项可获得更多信息,并查看其他选项。 https://www.baeldung.com/properties-with-spring