Spring读取资源文件
Spring配置文件
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/properties/*.properties</value>
</list>
</property>
<property name="fileEncoding" value="utf-8" />
</bean>
Java中获取属性
@Value("${prop1}")
private String myProperty;
Spring配置文件中获取属性
<property name="driverClassName" value="${DriverClass}"></property>
还没有评论,来说两句吧...