0

I am not talking about profiles feature in application.properties. I have local.properties file which is loaded to ZooKeeperPropertySource and I want properties which are there, to be treated like the ones set in application.properties and still be able to use application.properties.

I have found one solution: spring.config.location which enables to set multiple sources so I would set default application.properties as first source and local.properties as second source. But I don't want to it by passing environent variable, I want to do it in code/config. Are there any additional ways of achieving that? Ideally, I would like to use properties from ZooKeeperPropertySource.

ctomek
  • 1,696
  • 16
  • 35

1 Answers1

1

You can change Spring Boot startup defaults in your Spring Boot Application class. For example, also look for local.properties files:

public static void main(String[] args) {
    ConfigurableApplicationContext applicationContext = new 
    SpringApplicationBuilder(Application.class)
            .properties("spring.config.name:application,local")
            .build()
            .run(args);
}

You do need to modify the spring.config.name property, otherwise it will only look for application.properties files.

SteveD
  • 5,396
  • 24
  • 33