各种加载属性文件
1、spring加载
<context:property-placeholder location="classpath:config.properties"/>
等价于
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
2、Properties
InputStream inputstream = getClass().getResourceAsStream("/key.properties");
properties.load(inputstream);
3、加载属性文件直接放入到Map中
<bean id="cacheManagerFactory" class="com.trunkbow.epay.alipay.cache.CacheManagerFactory">
<property name="bankToOnlineMap">
<bean class="org.springframework.core.io.support.PropertiesLoaderUtils" factory-method="loadProperties">
<constructor-arg value="classpath:errorCode/bankToOnline.properties"/>
</bean>
</property>
</bean>
#对象
com.trunkbow.epay.alipay.cache.CacheManagerFactory{
private Map<String,String> onlineToAlipayMap= new HashMap()
}