spring cloud - 我的罐子外的 bootstrap.properties [英] spring cloud - bootstrap.properties outside my jar
问题描述
我试图将 bootstrap.properties
从我的 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?
这是它的内容 - 指向 spring 服务器配置
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 使用相同的 locations as spring boot 以查找bootstrap.properties
(或.yml代码>).所以
classpath:,classpath:/config,file:,file:config/
是默认搜索路径,./config/
是最高优先级.如果您的文件在 ./config
或 ./
中,它应该可以正常工作.属性 (spring.cloud.bootstrap.location
) 到 更改位置 与引导略有不同.
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.properties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!