0
我根據參考指南http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config-application-property-files設置了一個Spring Boot 1.3.0應用程序。所有在OS X上工作正常。application.properties
文件從當前目錄加載。 @Value
表達式已正確解析。Spring Boot外部化配置不適用於Windows?
在Windows Server 2008 R2/Java 1.8上,彈簧barfs:Could not resolve placeholder 'database.name' in string value "${database.name}"
。顯然,屬性文件沒有找到/加載。
我用starter web創建了一個示例項目並設置了'database.name'我已經能夠在Bean參數上使用@Value(「$ {database.name}」)獲取屬性,我在Windows上運行10.你是否在'application.properties'或另一個文件上設置屬性? –
是該文件被稱爲'application.properties'。 –
可能是關於Windows Server上的文件的一些配置?我發佈了示例[這裏](https://github.com/joaoevangelista/community-anwsers/tree/master/so-33739176)沒有什麼特別的,也許它是os和文件路徑/安全相關而不是Spring。 –