【发布时间】:2014-03-08 08:44:17
【问题描述】:
我是 spring 新手,但我仍然不太了解 spring 的层次结构和术语。我正在用 spring 实现一个 RESTful 应用程序。在搜索并阅读了有关如何使 spring 国际化的信息后,我尝试在我的应用程序中进行操作。但在我看来,它没有正确配置。因为我得到了例外。我想向您展示我的项目结构的屏幕截图。还有我想问你为什么我的applicationContext.xml显示有问题。
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>
【问题讨论】:
标签: spring spring-mvc internationalization