spring
<context:property-placeholder local-override="true" properties-ref="dataSourceProperties"
file-encoding="UTF-8" location="classpath:loc/config.properties"
ignore-resource-not-found="true" />
3.1以前property-placeholder使用的是org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
支持
protected String convertProperty(String propertyName, String propertyValue)
}
不支持通配符
因此如下,重写convertProperty进行加解密,重写setLocation使其支持通配符*加载配置文件
application-context.xml加入
<bean id="decryptPropertyPlaceholderConfigurer"
class="com.spring.demo.utils.DecryptPropertyPlaceholderConfigurer"
p:location="classpath*:*.properties,classpath*:loc/*.properties">
</bean>