使用Spring中的PropertiesFactoryBean读取配置文件内容,文件中有中文,出现了乱码,原因是没有设置fileEncoding属性,改成如下配置:
<bean id="setting"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:config.properties
</value>
</list>
</property>
<property name="fileEncoding" value="UTF-8"></property>
</bean>
转载请注明原文地址: https://ju.6miu.com/read-39882.html