Spring Framework ContextLoader - 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 ContextLoader class.

This code example shows how to use the following methods:
 
/** 
 * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> 
 * @version $Revision: 1 $ 
 */ 
public class SpringContextLoader extends ContextLoader 
{ 
   private SpringContextLoaderSupport springContextLoaderSupport = new SpringContextLoaderSupport(); 
 
   protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext configurableWebApplicationContext) 
   { 
      super.customizeContext(servletContext, configurableWebApplicationContext); 
      this.springContextLoaderSupport.customizeContext(servletContext,configurableWebApplicationContext); 
   } 
} 
5
CodeRank
This code example shows how to use the following methods:
import javax.servlet.ServletContext; 
import javax.servlet.ServletContextEvent; 
 
/** 
 * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> 
 * @version $Revision: 1 $ 
 */ 
public class SpringContextLoaderListener extends ContextLoaderListener 
{ 
   private SpringContextLoaderSupport springContextLoaderSupport = new SpringContextLoaderSupport(); 
 
   @Override 
   public void contextInitialized(ServletContextEvent event) 
   { 
      boolean scanProviders = false; 
      boolean scanResources = false; 
 
      String sProviders = event.getServletContext().getInitParameter("resteasy.scan.providers"); 
      if (sProviders != null) 
      { 
5
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
 
public class CustomizingContextLoader extends ContextLoader 
{ 
    private final ApplicationContextCustomizer customizer; 
 
    public CustomizingContextLoader(ApplicationContextCustomizer customizer) 
    { 
        this.customizer = customizer; 
    } 
 
    @Override 
    protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) 
    { 
        customizer.customizeApplicationContext(servletContext, applicationContext); 
    } 
 
    @Override 
    protected Class determineContextClass(ServletContext servletContext) throws ApplicationContextException 
    { 
        String contextClassName = servletContext.getInitParameter(CONTEXT_CLASS_PARAM); 
5
CodeRank
This code example shows how to use the following methods:
 * The patch configuration files are merged into the above config 
 * {@link org.broadleafcommerce.common.extensibility.context.merge.MergeXmlConfigResource}. 
 * 
 * @author Jeff Fischer 
 */ 
public class MergeContextLoader extends ContextLoader { 
 
    /** 
     * Name of servlet context parameter (i.e., "<code>patchConfigLocation</code>") 
     * that can specify the config location for the rootId context. 
     */ 
    public static final String PATCH_LOCATION_PARAM = "patchConfigLocation"; 
     
    /** 
     * Name of a bean to hook before Spring shutdown for this 
     * context commences. 
     */ 
    public static final String SHUTDOWN_HOOK_BEAN = "shutdownHookBean"; 
     
    /** 
5
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
     */ 
    protected ContextLoader createContextLoader() 
    { 
        return new JEEContextLoader(); 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
 * ejbs. The bootstrapper config file is part of the jetty spring jar. 
 *  
 * This spring context will be the parent context of the usual spring web app 
 * context (ie applicationContext.xml). 
 */ 
public class JEEContextLoader extends ContextLoader 
{ 
 
    protected ApplicationContext loadParentContext(ServletContext servletContext) 
    throws BeansException  
    { 
        Log.info("Bootstrapping JEE application context"); 
        ApplicationContext parentContext = new ClassPathXmlApplicationContext(  
                new String[] { "classpath*:/META-INF/spring-ejb-jar.xml"}); 
 
        return parentContext; 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
	public static final String BFL_CONTEXT_CONFIG_LOCATION = "bflContextConfigLocation"; 
	 
	public static final String CREATE_PARENT_WEB_APPLICATION_CONTEXT = "createParentWebApplicationContext"; 
	 
	public BeanFactoryLanguageContextLoader() { 
		super(); 
	} 
 
	protected WebApplicationContext createWebApplicationContext(ServletContext servletContext, ApplicationContext parent) throws BeansException { 
		ApplicationContext secondParent = null; 
		String bflContextConfigLocation = servletContext.getInitParameter(BFL_CONTEXT_CONFIG_LOCATION); 
		String createParentWebApplicationContext = servletContext.getInitParameter(CREATE_PARENT_WEB_APPLICATION_CONTEXT); 
		Collection beanReferences = null; 
		 
		if (createParentWebApplicationContext != null && createParentWebApplicationContext.toLowerCase().equals("true")) { 
			secondParent = super.createWebApplicationContext(servletContext, parent); 
		} else { 
			secondParent = parent; 
		} 
		 
5
CodeRank
This code example shows how to use the following methods:loadParentContext
	@Override 
	protected ApplicationContext loadParentContext(ServletContext servletContext) { 
		if (applicationContext != null) { 
			return applicationContext; 
		} 
		return super.loadParentContext(servletContext); 
	} 
 
	public static synchronized void setContext(ApplicationContext context) { 
		if (context == null) { 
			throw new IllegalArgumentException(); 
		} 
		if (applicationContext != null) { 
			throw new IllegalStateException(); 
		} 
		applicationContext = context; 
	} 
 
	public static synchronized void clearContext() { 
		applicationContext = null; 
4
CodeRank
See Code Examples for Spring Framework ContextLoader Methods: