Spring使用拦截器支持国际化(转)
3 月,跳不动了?>>> Spring使用拦截器支持国际化很方便,使用时只需要两个步骤: 一.spring配置 具体配置方式如下: <!-- 资源文件绑定器,文件名称:messages.properties(没有找到时的默认文件), messages_en.properties(英文),messages_zh_CN.properties(中午),等等--> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename" value="config.messages.messages" /> </bean> <!-- 定义本地化变更拦截器 --> <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" /> <util:list id="interceptors"> <ref bean="localeChangeInterceptor" /> </util:list> <!-- 定义注解URL映射处理器 ,所有的请求映射必须关联本地化拦截器-->