spring cloud - bootstrap.properties outside my jar

Amir Botvinik Nadiv picture Amir Botvinik Nadiv · Apr 21, 2016 · Viewed 8.5k times · Source

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

Answer

spencergibb picture spencergibb · Apr 21, 2016

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.