spring cloud - 我的jar外面的bootstrap.properties

Ami*_*div 6 java spring spring-cloud spring-cloud-config

我试图bootstrap.properties从我的罐子外面放置,所以它不会被其他开发人员错误地覆盖.你能在这里建议吗?

这是它的'内容 - 指向spring server config

# application name
spring.application.name=elixium
# The server entry point
spring.cloud.config.uri=http://localhost:8888
Run Code Online (Sandbox Code Playgroud)

spe*_*ibb 8

Spring Cloud使用与spring boot相同的位置来查找bootstrap.properties(或.yml).所以classpath:,classpath:/config,file:,file:config/是默认的搜索路径,./config/是最高优先级.如果你的文件在,./config./它应该只是工作.更改位置的property(spring.cloud.bootstrap.location)与boot略有不同.

  • 不,它必须是 env var、cmd line arg 或 java 系统属性,否则你会遇到鸡和蛋的问题。如果您不提前知道位置,如何读取 bootstrap.properties 的位置。 (2认同)