Par*_*rth 6 java spring localization spring-mvc
我有几个servlet旨在保存自己的消息源,但是有一个静态函数使用此消息源作为备份,并且在正常情况下使用全局BDB来检索本地化文本.
我想知道是否有一种方法可以检索调用此全局静态函数的servlet上下文的MessageSource?
我不能在所有servlet中使用MessageSourceAware.我查看了Spring文档,发现了MessageSourceAware和@autowired属性.我不能使用注释,因为我使用的是Spring 2.0.
任何帮助赞赏.
谢谢,Parth
如果您的MessageSource是在WebApplicationContext中定义的,则可以通过以下方式检索它:
WebApplicationContext webAppContext = RequestContextUtils.getWebApplicationContext(request);
MessageSource messageSource = webAppContext.getBean("messageSource");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6861 次 |
| 最近记录: |