Spring Framework ContextLoaderListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ContextLoaderListener class.

This code example shows how to use the following methods:
				MongoDbRepositoryConfig.class 
				//GemfireRepositoryConfig.class, 
				//Neo4jRepositoryConfig.class 
		); 
 
		servletContext.addListener(new ContextLoaderListener(rootCtx)); 
		//    servletContext.addFilter("springSecurity", DelegatingFilterProxy.class); 
		//    servletContext.getFilterRegistration("springSecurity").addMappingForUrlPatterns( 
		//        EnumSet.of(DispatcherType.REQUEST), 
		//        false, 
		//        "/*" 
		//    ); 
 
		AnnotationConfigWebApplicationContext webCtx = new AnnotationConfigWebApplicationContext(); 
		webCtx.register(RestExporterExampleRestConfig.class); 
 
		DispatcherServlet dispatcherServlet = new DispatcherServlet(webCtx); 
		ServletRegistration.Dynamic reg = servletContext.addServlet("rest-exporter", dispatcherServlet); 
		reg.setLoadOnStartup(1); 
		reg.addMapping("/*"); 
6
CodeRank
This code example shows how to use the following methods:
         
        final ServletContextHandler servletContext = new ServletContextHandler(serverReference, "/");
 
        servletContext.getInitParams().putAll(initParams);
 
        servletContext.addEventListener(new ContextLoaderListener());
 
        return servletContext;
    } 
 
    public void go() throws Exception {
        jettyServerReference.start();
    } 
 
    public static void main(String[] args) throws Exception {
        new AuthApp(8080).go(); 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
 
        final ServletContextHandler servletContext = new ServletContextHandler(serverReference, "/");
 
        servletContext.getInitParams().putAll(initParams);
 
        servletContext.addEventListener(new ContextLoaderListener());
 
        return servletContext;
    } 
 
    public void go() throws Exception {
        jettyServerReference.start();
    } 
 
    public static void main(String[] args) throws Exception {
        new VersionRoutingApp(8080).go(); 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
	public void onStartup(ServletContext servletContext) throws ServletException { 
		// Create the dispatcher servlet's Spring application context 
		AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); 
		dispatcherContext.register(WebConfiguration.class); 
 
		servletContext.addListener(new ContextLoaderListener(dispatcherContext)); 
 
 
		ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); 
		dispatcher.setLoadOnStartup(1); 
		dispatcher.setAsyncSupported(true); 
		dispatcher.addMapping("/"); 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:
 
        AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); 
        rootContext.register(AppRootConfig.class); 
 
        // Manage the lifecycle of the root application context 
        container.addListener(new ContextLoaderListener(rootContext)); 
 
        container.addFilter("resourceUrlEncodingFilter", ResourceUrlEncodingFilter.class).addMappingForUrlPatterns( 
                EnumSet.allOf(DispatcherType.class), false, "/*"); 
 
        // Create the dispatcher servlet's Spring application context 
        AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); 
        dispatcherContext.register(WebConfig.class); 
 
        // Register and map the dispatcher servlet 
        ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet( 
                dispatcherContext)); 
        dispatcher.setLoadOnStartup(1); 
        dispatcher.addMapping("/"); 
    } 
6
CodeRank
This code example shows how to use the following methods:
 * {@link org.springframework.web.util.Log4jConfigListener} 
 * in <code>web.xml</code>, if the latter is used. 
 * 
 * @author Jeff Fischer 
 */ 
public class MergeContextLoaderListener extends ContextLoaderListener { 
 
    /** 
     * Create the ContextLoader to use. Can be overridden in subclasses. 
     * @return the new ContextLoader 
     */ 
    protected MergeContextLoader createContextLoader() { 
        return new MergeContextLoader(); 
    } 
 
 
    @Override 
    public void contextInitialized(ServletContextEvent event) { 
        super.contextInitialized(event); 
        ThreadLocalManager.remove(); 
6
CodeRank
This code example shows how to use the following methods:
    } 
 
    private ServletContextHandler buildRootContext(Server serverReference) {
        final ServletContextHandler servletContext = new ServletContextHandler(serverReference, "/");
        servletContext.getInitParams().put("contextConfigLocation", "classpath:/META-INF/application-context.xml");
        servletContext.addEventListener(new ContextLoaderListener());
 
        return servletContext;
    } 
 
    public Server newServer() { 
        return buildNewInstance(); 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
    public void onStartup(final ServletContext sc) throws ServletException { 
 
        //1、根上下文 
        AnnotationConfigWebApplicationContext  rootContext = new AnnotationConfigWebApplicationContext(); 
        rootContext.register(RootConfiguration.class); 
        sc.addListener(new ContextLoaderListener(rootContext)); 
 
        //2、springmvc上下文 
        AnnotationConfigWebApplicationContext springMvcContext = new AnnotationConfigWebApplicationContext(); 
        springMvcContext.register(SpringMvcConfiguration.class); 
 
        //3、DispatcherServlet 
        DispatcherServlet dispatcherServlet = new DispatcherServlet(springMvcContext); 
 
        ServletRegistration.Dynamic dynamic = sc.addServlet("dispatcherServlet", dispatcherServlet); 
        dynamic.setLoadOnStartup(1); 
        dynamic.addMapping("/"); 
 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
 * Custom context loader listener that emits a {@link ContextLoadedEvent} once the  
 * application context has been successfully loaded. 
 *  
 * @author Justin Deoliveira, OpenGeo 
 */ 
public class GeoServerContextLoaderListener extends ContextLoaderListener { 
 
    @Override 
    public void contextInitialized(ServletContextEvent event) { 
        super.contextInitialized(event); 
        ApplicationContext appContext = getContextLoader().getCurrentWebApplicationContext(); 
        if (appContext != null) { 
            appContext.publishEvent(new ContextLoadedEvent(appContext)); 
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
 
		try { 
			doInvokeDeploy(hotDeployEvent); 
		} 
		catch (Throwable t) { 
			throwHotDeployException( 
				hotDeployEvent, "Error initializing Spring for ", t); 
		} 
	} 
 
	@Override 
	public void invokeUndeploy(HotDeployEvent hotDeployEvent) 
		throws HotDeployException { 
 
		try { 
			doInvokeUndeploy(hotDeployEvent); 
		} 
		catch (Throwable t) { 
			throwHotDeployException( 
				hotDeployEvent, "Error uninitializing Spring for ", t); 
6
CodeRank
See Code Examples for Spring Framework ContextLoaderListener Methods: