【公司框架返回中文定制消息乱码 】 | IT修真院·坑乎
问题已收录 公司框架返回中文定制消息乱码
我也踩过这个坑( 1 )
已统计您的踩坑,无需重复点击
回答(1)
详细描述
错误截图
编辑于2024-05-10
  • [深圳|结业弟子]JAVA-苏晔
    0

    这里是因为Spring默认的消息编码是非UTF8的。将设置改成如下就好:

     <bean id="messageSource"
              class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basenames">
                <set>
                    <value>classpath:exception-messages-play</value>
                </set>
            </property>
            <property name="useCodeAsDefaultMessage" value="true"/>
            <property name="defaultEncoding" value="UTF-8"/>
    </bean>


    编辑于2018-07-20