List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:gov.nih.nci.caintegrator.application.configuration.SpringContext.java
protected static synchronized WebApplicationContext initialize(final ServletContext servletContext) { if (wac == null) { wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); initialized = true;//from www .j a v a2 s . c om } return wac; }
From source file:com.vaadinspring.ui.SpringContextHelper.java
public SpringContextHelper(ServletContext servletContext) { context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); // System.out.println(context.getBeanDefinitionNames()); }
From source file:sg.edu.ntu.hrms.web.action.BaseAction.java
public BaseAction() { ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext()); }
From source file:mx.dr.ml.service.util.WebServiceLocator.java
/** * Get Spring Service Bean Instance/* w w w. ja va2 s . c o m*/ * @param clazz Service class * @param context application sevlet context * @return service Instance */ public static <T extends Object> T getBean(Class clazz, ServletContext context) { return (T) WebApplicationContextUtils.getRequiredWebApplicationContext(context) .getBean(clazz.getSimpleName()); }
From source file:net.easysmarthouse.ui.webui.server.ServerBaseServlet.java
private void initServerContext() { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); //for populate existing bean instances that Spring does not control the lifecycle of AutowireCapableBeanFactory beanFactory = wac.getAutowireCapableBeanFactory(); beanFactory.autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_NO, false); beanFactory.initializeBean(this, this.getClass().getName()); }
From source file:nl.tue.gale.tools.GaleToolsUtil.java
public static Object getBean(ServletContext sc, String name) { ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(sc); return applicationContext.getBean(name); }
From source file:in.anjan.struts2webflow.FlowExecutorUtils.java
/** * {@link FlowExecutor Flow executor} must be configured in the Spring * web application context hierarchy.//from w w w . j a v a 2 s . c o m * * @param flowExecutorBean {@link FlowExecutor flow executor} bean name to * be used * @return {@link FlowExecutor flow executor} bean * @throws RuntimeException in case {@link FlowExecutor flow executor} is * not configured in the Spring web application * context hierarchy. */ public static FlowExecutor getRequiredFlowExecutor(String flowExecutorBean) { // need to find the Spring web application context WebApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(ServletActionContext.getServletContext()); // have the flow executor configured? // if yes, get the flow execution // else, blame if (context.containsBean(flowExecutorBean)) return context.getBean(flowExecutorBean, FlowExecutor.class); throw new RuntimeException("Flow executor named as '" + flowExecutorBean + "' not found!"); }
From source file:controladores.DepartamentosController.java
private Object getBean(String nombrebean, ServletContext servlet) { ApplicationContext contexto = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet); Object beanobject = contexto.getBean(nombrebean); return beanobject; }
From source file:org.codehaus.marmalade.msp.support.MSPServlet.java
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Serving Marmalade Page."); ApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(servletConfig.getServletContext()); MSPHandler mspHandler = (MSPHandler) ctx.getBean(MSPHandler.BEAN_ID); mspHandler.execute(request, response); }
From source file:com.fpmislata.banco.presentation.database.ServerContextListenerImpl.java
@Override public void contextInitialized(ServletContextEvent sce) { System.out.println("Iniciando"); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(sce.getServletContext()); AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext .getAutowireCapableBeanFactory(); autowireCapableBeanFactory.autowireBean(this); databaseMigration.migrate();/* w ww . j ava 2s .c o m*/ }