1
我使用Spring @PropertySource
註釋根據環境變量加載屬性文件。 (在System variables
of this window在Windows中設置)環境變量不支持UTF-8?
我設置MY_APP = C:\Cliché
現在我@Configuration
類還標註有:
@PropertySource(value = "file:${MY_APP}/config/my.properties"
但是,因爲它似乎解決春季無法加載文件URL /路徑爲:C:\Clich,\config\my.properties
爲什麼?
但這些設置是用於讀取** **內容的屬性文件嗎? – maxxyme
for @propertysource是, 但是爲了解釋您的系統編碼,您需要設置file.encoding = UTF-8 – kuhajeyan
既不是''編碼=「UTF-8」''作爲''@ PropertySource''屬性,也不添加'' - Dfile.encoding = UTF-8''到我的Tomcat虛擬機參數的工作。 只要我運行一個純Java-config的Spring應用程序,就無處可以設置這個''System.setProperty(「file.encoding」,「UTF-8」);''行來嘗試...... – maxxyme