code: protected void prepareWebApplicationContext(ServletContext servletContext) {
  		Object rootContext = servletContext.getAttribute(
  				WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  		if (rootContext != null) {
  			if (rootContext == this) {
  				throw new IllegalStateException(
  						"Cannot initialize context because there is already a root application context present - "
  								+ "check whether you have multiple ServletContextInitializers!");
  			}
  			return;
  		}
  		Log logger = LogFactory.getLog(ContextLoader.class);
  		servletContext.log("Initializing Spring embedded WebApplicationContext");
  		try {
  			servletContext.setAttribute(
  					WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this);
  			if (logger.isDebugEnabled()) {
  				logger.debug(
  						"Published root WebApplicationContext as ServletContext attribute with name ["
  								+ WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
  								+ "]");
  			}
  			setServletContext(servletContext);
  			if (logger.isInfoEnabled()) {
  				long elapsedTime = System.currentTimeMillis() - getStartupDate();
  				logger.info("Root WebApplicationContext: initialization completed in "
  						+ elapsedTime + " ms");
  			}
  		}
  		catch (RuntimeException | Error ex) {
  			logger.error("Context initialization failed", ex);
  			servletContext.setAttribute(
  					WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
  			throw ex;
  		}
  	}
docs: Prepare the {@link WebApplicationContext} with the given fully loaded
  {@link ServletContext}. This method is usually called from
  {@link ServletContextInitializer#onStartup(ServletContext)} and is similar to the
  functionality usually provided by a {@link ContextLoaderListener}.
  @param servletContext the operational servlet context