Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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
–
–
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.
–
–
–
–
spring.cloud.bootstrap.location
behaves like spring.config.location
(in Spring Boot 2), it replaces the location of these configuration files.
To make it working, it has to defined as a system property.
For example :
With Jar :
java -jar
-Dspring.cloud.bootstrap.location=anyLocation/bootstrap.yml
With Spring Boot maven plugin :
mvn spring-boot:run
-Dspring-boot.run.jvmArguments="-Dspring.cloud.bootstrap.location=anyLocation/bootstrap.yml"
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.