2016-04-21 39 views
2

我想從我的jar外面放bootstrap.properties,所以它不會被其他開發者錯誤地覆蓋。你能在這裏諮詢一下嗎?彈簧雲 - 我的jar外的bootstrap.properties

這是它的內容 - 引導到春天服務器配置

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

您能否提供更多的細節?你有什麼嘗試?如果你嘗試了一些東西,但失敗了,錯誤是什麼? – spencergibb

+0

我已經嘗試使用@PropertyResource,他忽略了外部位置,並開始在tomcat默認端口 –

回答

2

春雲使用相同locations as spring boot找到bootstrap.properties(或.yml)。所以classpath:,classpath:/config,file:,file:config/是默認搜索路徑,./config/是最高優先級。如果您的文件在./config./它應該只是工作。該屬性(spring.cloud.bootstrap.location)至change the location與啓動稍有不同。

+0

謝謝斯賓塞,是的,我想改變它的位置。那麼我應該在bootstrap.properties中使用spring.cloud.bootstrap.location嗎? –

+0

不,它需要是env var,cmd行arg或java系統屬性,否則會出現雞和蛋問題。如果您提前不知道位置,您如何閱讀'bootstrap.properties'的位置。 – spencergibb

+0

那麼它可以達到bootstrap.properties,但我想指示它在我的罐外 –