spring通过ApplicationContext读取Bean、message实例
1、读取Bean的应用
?
ServletContext application = getServletContext(); // 读取SPRING 容器ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(application);// 读取容器中的QUARTZ总管类org.quartz.Scheduler scheduler = (org.quartz.impl.StdScheduler)ctx.getBean("startQuertz");?2、读取国际化的应用
Object[] obj = new Object[]{}; Locale locale = (Locale)request.getSession().getAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME);ServletContext servletContext = request.getSession().getServletContext();ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);String iString = ctx.getMessage(code, obj, locale);?