1

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.

James
  • 2,876
  • 18
  • 72
  • 116

1 Answers1

0

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;
    }
}
Panup Pong
  • 1,871
  • 2
  • 22
  • 44
  • Thanks but I already know how to do this with properties files. I need to use yml files. – James Nov 21 '17 at 14:58