1,applicationContext.xml
用自定义扩展类DataBasePropertyPlaceholderConfigurer替换Spring的PropertyPlaceholderConfigurer
<!-- 从数据库配置表加载系统配置属性 -->
<bean id="dataBasePropertyConfigurer" class="com.crc.util.DataBasePropertyPlaceholderConfigurer">
</bean>
2,DataBasePropertyPlaceholderConfigurer.java
package com.crc.util;
import java.util.Properties;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
public class DataBasePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer
{
@Override
public Properties mergeProperties()
{
return ConfigPropertiesUtil.getProperties();
}
}
3,ConfigPropertiesUtil.java,从数据库读取配置数据的工具类
package com.crc.util;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
i