Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在spring引导中加载具有相同根密钥的多个yaml文件_Spring_Spring Boot_Yaml - Fatal编程技术网

在spring引导中加载具有相同根密钥的多个yaml文件

在spring引导中加载具有相同根密钥的多个yaml文件,spring,spring-boot,yaml,Spring,Spring Boot,Yaml,我想在SpringBoot中寻找一个解决方案,在这个解决方案中,我可以在多个文件中维护相同的根密钥,并将其加载到POJO application-profile-1.yml active: configuration: - name: abc ....... (1000 lines in config) 也许这有帮助 application-profile-2.yml active: configuration: - name: xyz ....... (900 lin

我想在SpringBoot中寻找一个解决方案,在这个解决方案中,我可以在多个文件中维护相同的根密钥,并将其加载到POJO

application-profile-1.yml
active:
  configuration:
  - name: abc
  ....... (1000 lines in config)
也许这有帮助
application-profile-2.yml
active:
  configuration:
  - name: xyz
  ....... (900 lines in config)
application-profile-3.yml
active:
  configuration:
  - name: abc
  ....... (700 lines in config)
application.yml
spring.profiles.include: profile-1,profile-2,profile-3
@ConfigurationProperties(prefix = "active")
public class ActiveData {
   private List<Configuration> channels = null;
}
Service {
    @Autowired
    private ActiveData activeData;

    serviceMethod() {
        activeData.configuration(); --> is coming as null
    }

}