springmvc讀取本地配置文件

有個需求須要讀取服務器本地配置文件,實現代碼以下便可:redis

xmlns:context="http://www.springframework.org/schema/context"
<context:property-placeholder
		location="classpath:redisServer.properties,file:/home/.settings/redisServer.properties"
		ignore-resource-not-found="true" />

使用file讀取本地。配置文件同名便可。spring會默認使用最後加載的配置文件。注意是覆蓋配置文件裏的key。spring

相關文章
相關標籤/搜索