0
点赞
收藏
分享

微信扫一扫

spring mvc properties 中文乱码


properties中加了配置,有中文,不设置一下的话,注入bean读出来的是乱码,是这样的:

{1,"֪ͨÊé±àºÅ"},{2£¬"ѧÉúÁбí"}

在spring-servlet.xml中设置一下编码格式就好了

<!--加载配置文件-->
<context:property-placeholder location="classpath:config.properties" file-encoding="gb2312"/>

<!--注入导出类别类型-->
<bean id="exportType" class="com.normalClass.ExportType">
<property name="types" value="${config.export.type}"></property>
</bean>

public class ExportType {
private static String types;

public void setTypes(String types) {
ExportType.types = types;
}

public static String getTypes() {
return


举报

相关推荐

0 条评论