前几天因为配置文件的事,线上的job挂掉了,使用的是spring加载配置文件方式。
spring配置如下
<span style="font-family:SimSun;font-size:14px;"> <bean id="propertyConfigurer" class="com.*.base.commons.system.DecryptPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>test.properties</value>
<value>api-test.properties</value>
</list>
</property>
</bean></span>
DecryptPropertyPlaceholderConfigurer类如下所示。
<span style="font-family:SimSun;font-size:14px;"><span style="font-family: Arial, Helvetica, sans-serif;">public class DecryptPropertyPlaceholderConfigurer extends<PropertyPlaceholderConfigurer {
private Resource[] locations;
private String fileEncoding;
public void setFileEncoding(String fileEncoding) {
this.fileEncoding = fileEncoding;
}
public void setLocations(Resource[] locations) {
this.locations = locations;
}
public void loadProperties(Properties props) throws IOException {
String systemBasePath = "/etc/test/config";
if (this.locations != null) {
PropertiesPersister propertiesPersister = new DefaultPropertiesPersister();
for (int i = 0; i < this.locations.length;

最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



