javaspringspring-cloudspring-cloud-config

spring cloud - bootstrap.properties outside my jar


I am trying to put bootstrap.properties from outside my jar, so it won't get overridden by other developers by mistake. Could you please advice here?

This is its' content - directing to the spring server config

# application name
spring.application.name=elixium
# The server entry point
spring.cloud.config.uri=http://localhost:8888

Solution

  • Spring Cloud uses the the same locations as spring boot to find bootstrap.properties (or .yml). So classpath:,classpath:/config,file:,file:config/ is the default search path, ./config/ is the highest precedence. If your file is in ./config or ./ it should just work. The property (spring.cloud.bootstrap.location) to change the location is slightly different than boot.