Equivalent to
<pre>{@code webappConfigFactory()
.bind(ServletContextPath.class, servletContextPath)
}</pre>.

@see #webappConfigFactory()
191451
public static ConfigFactory
    webappConfigFactory(ServletContextPath servletContextPath) {

        checkNotNull(servletContextPath);

        return webappConfigFactory()
            .bind(ServletContextPath.class)
            .toInstance(servletContextPath);
    }
600743
public static GrailsApplication findApplication(ServletContext servletContext) {
        ApplicationContext wac = findApplicationContext(servletContext);
        if(wac != null) {
            return (GrailsApplication)wac.getBean(GrailsApplication.APPLICATION_ID);
        }
        return null;
    }
593869
public static URLTemplatesFactory getURLTemplatesFactory( ServletContext servletContext )
    {
        assert servletContext != null : "The ServletContext cannot be null.";

        if ( servletContext == null )
        {
            throw new IllegalArgumentException( "The ServletContext cannot be null." );
        }

        return ( URLTemplatesFactory ) servletContext.getAttribute( URL_TEMPLATE_FACTORY_ATTR );
    }
425036
public static WebApp get(ServletContext context) {
        Object o = context.getAttribute(WebApp.class.getName());
        if(o==null) {
            synchronized (WebApp.class) {
                o = context.getAttribute(WebApp.class.getName());
                if(o==null) {
                    o = new WebApp(context);
                    context.setAttribute(WebApp.class.getName(),o);
                }
            }
        }
        return (WebApp)o;
    }
57382
public void setContextName(final String contextName) {
		NullArgumentException.validateNotNull(contextName, "Context name");
		this.contextName = contextName;

		// remove the previous setting.
		WebAppInitParam prev = getWebAppInitParam("webapp.context");
		if (prev != null) {
			contextParams.remove(prev);
		}

		// set the context name into the context params
		final WebAppInitParam initParam = new WebAppInitParam();
		initParam.setParamName("webapp.context");
		initParam.setParamValue(contextName);
		contextParams.add(initParam);
	}
996180
Configuration loadConfig(ServletContext servletContext) {
        String handlers = servletContext.getInitParameter(ContextConfigParams.PARAM_HANDLERS);
        String layout = servletContext.getInitParameter(ContextConfigParams.PARAM_LAYOUT);
        String filters = servletContext.getInitParameter(ContextConfigParams.PARAM_FILTERS);
        String options = servletContext.getInitParameter(ContextConfigParams.PARAM_OPTIONS);
        String metaData = servletContext.getInitParameter(ContextConfigParams.PARAM_META_DATA);
        String properties = servletContext.getInitParameter(ContextConfigParams.PARAM_PROPERTIES);

        Configuration config = Configuration.INSTANCE;
        if (handlers != null && !handlers.equals("")) {
            config.setHandlers(new ReflectUtil<Handler>().getNewInstanceList(handlers.split(";")));
        }
        config.setLayout(new ReflectUtil<Layout>().getNewInstance(layout));
        if (filters != null && !filters.equals("")) {
            config.setFilters(new ReflectUtil<AuditEventFilter>().getNewInstanceList(filters.split(";")));
        }
        config.setCommands(options);
        config.setMetaData(new ReflectUtil<MetaData>().getNewInstance(metaData));
        if (properties != null && !properties.equals("")) {
            String[] propertiesList = properties.split(";");
            for (String property : propertiesList) {
                String[] keyValue = property.split(":");
                config.addProperty(keyValue[0], keyValue[1]);
            }
        }
        return config;
    }
278808
public void addServlet(final WebAppServlet servlet) {
		NullArgumentException.validateNotNull(servlet, "Servlet");
		NullArgumentException.validateNotNull(servlet.getServletName(),
				"Servlet name");
		if (servlet instanceof WebAppJspServlet) {
			NullArgumentException.validateNotNull(
					((WebAppJspServlet) servlet).getJspPath(), "JSP-path");
		} else {
			NullArgumentException.validateNotNull(
					servlet.getServletClassName(), "Servlet class");
		}
		servlets.put(servlet.getServletName(), servlet);
		// add aliases for servlet mappings added before servlet
		for (WebAppServletMapping mapping : getServletMappings(servlet
				.getServletName())) {
			servlet.addUrlPattern(mapping.getUrlPattern());
		}
	}
654043
public void init(ApplicationConfig config) {
        PropertyMap properties = config.getProperties();
		String contextClassName = properties.getString("contextClass");
        if (contextClassName == null) {
            throw new IllegalArgumentException("contextClass");
        }
        
        try {
            contextClass = Class.forName(contextClassName);
            context = contextClass.newInstance();
            if (context instanceof Context) {
                Context castContext = (Context) context;
                ContextConfig contextConfig = new ContextConfig(
                    config.getProperties(), config.getLog(), 
                    config.getName(), config.getPlugins(),
                    config.getServletContext()
                );
                
                castContext.init(contextConfig);
            }
        } catch (Exception e) {
            throw new RuntimeException(
                "Unable to create context: " + contextClassName, e);
        }
    }
551293
public static void bind(ApplicationContext context) {
        Object old = contextMap.putIfAbsent(getContextClassLoader(), context);
        if (old != null) {
            throw new IllegalStateException(
                "There is already a ApplicationContext associated with the context ClassLoader of the current thread!");
        }
    }
861843
@Override
    public boolean configure(final FeatureContext context) {

        // Hibernate configuration.
        context.register(new HibernateSessionFactory.Binder());
        context.register(new HibernateSessionFactoryFactory.Binder());
        context.register(new HibernateServiceRegistryFactory.Binder());
        context.register(new FulltextSearchFactoryFactory.Binder());
        context.register(new FulltextSessionFactory.Binder());

        return true;
    }
417106
public AbstractEndpointBuilder<T> applicationContext(ApplicationContext applicationContext) {
        if (getEndpoint() instanceof ApplicationContextAware) {
            ((ApplicationContextAware) getEndpoint()).setApplicationContext(applicationContext);
        }

        if (getEndpoint() instanceof BeanFactoryAware) {
            ((BeanFactoryAware) getEndpoint()).setBeanFactory(applicationContext);
        }

        return this;
    }
1012138
public static <T> T registerBeanIntoApplicationContext(final ConfigurableApplicationContext applicationContext,
                                                           final T beanInstance, final String beanId) {
        val beanFactory = applicationContext.getBeanFactory();
        if (beanFactory.containsBean(beanId)) {
            return (T) applicationContext.getBean(beanId, beanInstance.getClass());
        }
        beanFactory.initializeBean(beanInstance, beanId);
        beanFactory.autowireBean(beanInstance);
        beanFactory.registerSingleton(beanId, beanInstance);
        return beanInstance;
    }
185203
private synchronized ApplicationContext getApplicationContext(URL config, boolean useCache) {
		
		if (!useCache || !config.equals(prevUrl)) {
			prevBeans = new FileSystemXmlApplicationContext(config.toExternalForm());
			prevUrl = config;
		}
		
		return prevBeans;		

	}
702144
public void bindWithApplication( String externalExportPrefix, String applicationName ) {

		Set<String> bounds = this.applicationBindings.get( externalExportPrefix );
		if( bounds == null ) {
			bounds = new LinkedHashSet<> ();
			this.applicationBindings.put( externalExportPrefix, bounds );
		}

		bounds.add( applicationName );
	}
471297
protected ModuleConfig initModuleConfig( String prefix, String paths ) throws ServletException
    {

        if ( _log.isDebugEnabled() )
        {
            _log.debug( "Initializing module path '" + prefix + "' configuration from '" + paths + '\'' );
        }

        // Parse the configuration for this module
        ModuleConfig moduleConfig = null;
        InputStream input = null;
        String mapping;
        
        try
        {
            ModuleConfigFactory factoryObject =
                    ModuleConfigFactory.createFactory();
            moduleConfig = factoryObject.createModuleConfig( prefix );

            // Support for module-wide ActionMapping type override
            mapping = getServletConfig().getInitParameter( "mapping" );
            if ( mapping != null )
            {
                moduleConfig.setActionMappingClass( mapping );
            }

            // Configure the Digester instance we will use
            Digester digester = initConfigDigester();

            // Process each specified resource path
            while ( paths.length() > 0 )
            {
                digester.push( moduleConfig );
                String path;
                int comma = paths.indexOf( ',' );
                if ( comma >= 0 )
                {
                    path = paths.substring( 0, comma ).trim();
                    paths = paths.substring( comma + 1 );
                }
                else
                {
                    path = paths.trim();
                    paths = "";
                }
                if ( path.length() < 1 )
                {
                    break;
                }
                
                URL url = getConfigResource( path );
                
                //
                // THIS IS THE MAIN DIFFERENCE: we're doing a null-check here.
                //
                if ( url != null )
                {
                    URLConnection conn = url.openConnection();
                    conn.setUseCaches(false);
                    InputStream in = conn.getInputStream();
                    
                    try {
                        InputSource is = new InputSource(in);
                        is.setSystemId(url.toString());
                        input = getConfigResourceAsStream( path );
                        is.setByteStream( input );
                        
                        // also, we're not letting it fail here either.
                        try
                        {
                            digester.parse( is );
                            getServletContext().setAttribute( Globals.MODULE_KEY + prefix, moduleConfig );
                        }
                        catch ( Exception e )
                        {
                            _log.error( Bundle.getString( "PageFlow_Struts_ModuleParseError", path ), e );
                        }
                        input.close();
                    } finally {
                        in.close();
                    }
                }
                else
                {
                    //
                    // Special case.  If this is the default (root) module and the module path is one that's normally
                    // generated by the page flow compiler, then we don't want to error out if it's missing, since
                    // this probably just means that there's no root-level page flow.  Set up a default, empty,
                    // module config.
                    //
                    if ( prefix.equals( "" ) && isAutoLoadModulePath( path, prefix ) )
                    {
                        if ( _log.isInfoEnabled() )
                        {
                            _log.info( "There is no root module at " + path + "; initializing a default module." );
                        }
                        
                        //
                        // Set the ControllerConfig to a MissingRootModuleControllerConfig.  This is used by
                        // PageFlowRequestProcessor.
                        //
                        moduleConfig.setControllerConfig( new MissingRootModuleControllerConfig() );
                    }
                    else
                    {
                        _log.error( Bundle.getString( "PageFlow_Struts_MissingModuleConfig", path ) );
                    }
                }
            }

        }
        catch ( Throwable t )
        {
            _log.error( internal.getMessage( "configParse", paths ), t );
            throw new UnavailableException( internal.getMessage( "configParse", paths ) );
        }
        finally
        {
            if ( input != null )
            {
                try
                {
                    input.close();
                }
                catch ( IOException e )
                {
                    // ignore
                }
            }
        }

        // Force creation and registration of DynaActionFormClass instances
        // for all dynamic form beans we will be using
        FormBeanConfig fbs[] = moduleConfig.findFormBeanConfigs();
        for ( int i = 0; i < fbs.length; i++ )
        {
            if ( fbs[i].getDynamic() )
            {
                DynaActionFormClass.createDynaActionFormClass( fbs[i] );
            }
        }

        // Special handling for the default module (for
        // backwards compatibility only, will be removed later)
        if ( prefix.length() < 1 )
        {
            defaultControllerConfig( moduleConfig );
            defaultMessageResourcesConfig( moduleConfig );
        }

        // Return the completed configuration object
        //config.freeze();  // Now done after plugins init
        return moduleConfig;

    }
860037
public WebApplicationContext addWebApplication(String contextPathSpec,
                                                   String webApp)
        throws IOException
    {
        return addWebApplication(null,contextPathSpec,webApp);
    }
1246882
@SuppressWarnings("unchecked")
	public void init(ServletContext context, JawrConfig config) {
		super.init(context, config);
		pluginPathMap = (Map<String, String>) context.getAttribute(pluginMapAttributeName);
		if (pluginPathMap == null) {
			throw new BundlingProcessException("No grails plugin paths map defined in the servlet context");
		}

		// Determine wether this is run-app or run-war style of runtime.
		warDeployed = ((Boolean) context.getAttribute(JawrGrailsConstant.GRAILS_WAR_DEPLOYED)).booleanValue();
	}