List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:org.tdmx.server.sx.Servlet.java
@Override public void initServletBean() { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); }
From source file:com.parleys.server.frontend.web.ipad.filters.LoginFilter.java
@Override public void init(FilterConfig filterConfig) { applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(filterConfig.getServletContext()); }
From source file:org.atmosphere.spring.bean.AtmosphereSpringServlet.java
@Override public void init(ServletConfig config) throws ServletException { super.init(config); WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()) .getAutowireCapableBeanFactory().autowireBean(this); // set the real servlet context atmosphereSpringContext.setServletContext(config.getServletContext()); framework.init(atmosphereSpringContext, false); }
From source file:sk.openhouse.web.filter.LocaleConfigurerFilter.java
@Override protected void initFilterBean() throws ServletException { WebApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); Map resolvers = context.getBeansOfType(LocaleResolver.class); if (resolvers.size() == 1) { localeResolver = (LocaleResolver) resolvers.values().iterator().next(); }//from w w w. j ava 2 s. c o m }
From source file:com.ryantenney.metrics.spring.servlets.MetricsServletsContextListener.java
@Override public void contextInitialized(ServletContextEvent event) { WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext()) .getAutowireCapableBeanFactory().autowireBean(this); metricsServletContextListener.contextInitialized(event); healthCheckServletContextListener.contextInitialized(event); }
From source file:de.beyondjava.examples.scopes.springInJSFBean.ViewScopeContainsAOPPrototypeScope.java
@PostConstruct private void init() { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); ServletContext servletContext = (ServletContext) externalContext.getContext(); WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getAutowireCapableBeanFactory() .autowireBean(this); }
From source file:nl.tjonahen.javaee7.cdi.springbridge.servletsupport.ApplicationContextFinder.java
@Override public void contextInitialized(ServletContextEvent sce) { WebApplicationContext requiredWebApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(sce.getServletContext()); ApplicationContextLocatorImpl.putContext(requiredWebApplicationContext); ApplicationContextManager.getInstance(); // trigger Application context locator }
From source file:com.khs.sherpa.spring.SpringApplicationContext.java
public SpringApplicationContext(ServletContext servletContext) { org.springframework.context.ApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); if (!context.containsBean("managedBeanFactory")) { BeanDefinitionRegistry registry = ((BeanDefinitionRegistry) context.getAutowireCapableBeanFactory()); GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(SpringManagedBeanFactory.class); registry.registerBeanDefinition("managedBeanFactory", beanDefinition); }//from ww w.j a va 2s. co m managedBeanFactory = context.getBean(ManagedBeanFactory.class); { BeanDefinitionRegistry registry = ((BeanDefinitionRegistry) context.getAutowireCapableBeanFactory()); GenericBeanDefinition beanDefinition = new GenericBeanDefinition(); beanDefinition.setBeanClass(SpringRequestEvent.class); registry.registerBeanDefinition(SpringRequestEvent.class.getCanonicalName(), beanDefinition); } }
From source file:org.dspace.webmvc.servlet.SpringFreemarkerDecoratorServlet.java
private Configuration getSpringConfiguration() { if (fmConfiguration != null) { return fmConfiguration; }//from w ww . j ava 2 s . com WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); String[] names = ctx.getBeanNamesForType(freemarker.template.Configuration.class); if (names != null && names.length > 0) { fmConfiguration = (Configuration) ctx.getBean(names[0]); } return fmConfiguration; }
From source file:net.noday.core.listener.StartupListener.java
@SuppressWarnings("unchecked") @Override/*from w w w . j a v a 2 s . co m*/ public void contextInitialized(ServletContextEvent sce) { ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context = sce.getServletContext()); appDao = ctx.getBean(AppDao.class); appCache = ctx.getBean("appCache", Map.class); loadAppConfig(); setWebProperty(); }