I have three projects. Proj 3 depends on Proj 2 and Proj 2 depends on Proj 1. Each project uses Spring Boot and is configured with yml files. I don't want to repeat the yml configuration of Proj 1 in Proj 2. Likewise, I don't want to repeat the in yml config of Proj 2 and Proj 1 in Proj 3.
How can this be done? As far as I know, I can only have one application.yml
file (in use) across all three project.
I tried to change my .properties to .yml and It works for me.
@Configuration
public class AppConfig {
@Profile("staging")
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("common-staging.yml"));
propertySourcesPlaceholderConfigurer.setProperties(yaml.getObject());
return propertySourcesPlaceholderConfigurer;
}
}