在spring引导中加载具有相同根密钥的多个yaml文件
我想在SpringBoot中寻找一个解决方案,在这个解决方案中,我可以在多个文件中维护相同的根密钥,并将其加载到POJO在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
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
}
}