如何使REST Spring-MVC应用程序国际化? [英] How to internationalize REST Spring-MVC application?
本文介绍了如何使REST Spring-MVC应用程序国际化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是spring的新手,我仍然不太了解spring
的层次结构和术语.我正在用Spring实现一个 RESTful 应用程序.搜索并阅读了有关如何使spring国际化的信息后,我尝试在我的应用程序中进行此操作.但是在我看来,它的配置不正确.因为我得到了例外.我想向您展示我的项目结构的屏幕截图.我想问你为什么我的applicationContext.xml
显示问题.
I am new with spring and I still don't know well about hierarchy and terminology of spring
. I am implementing a RESTful app with spring. After searching and reading about how to internationalize spring, I tried to do it in my app. But it seems to me it is not configured properly. Because I get exception. I would like to show you the screenshot of my project structure. And I would like to ask you why my applicationContext.xml
show a problem exist.
spring-servlet.xml
<!-- SPRING INTERNALIZATION CONFIGURATION -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8"/>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en"/>
</bean>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language" />
</bean>
<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
<ref bean="localeChangeInterceptor" />
</property>
</bean>
推荐答案
查看全文