docs: public static ApplicationContext getApplicationContext() {
          final ServletContext context = servletContext;
  
          if (context != null) {
              getLogger().debug("Using WebApplicationContext");
  
              if (applicationContextCreator.isCreated()) {
                  final IllegalStateException createException =
                          new IllegalStateException(
                                  "A portal managed ApplicationContext has already been created but now a ServletContext is available and a WebApplicationContext will be returned. "
                                          + "This situation should be resolved by delaying calls to this class until after the web-application has completely initialized.");
                  getLogger().error(createException, createException);
                  getLogger()
                          .error(
                                  "Stack trace of original ApplicationContext creator",
                                  directCreatorThrowable);
                  throw createException;
              }
  
              final WebApplicationContext webApplicationContext =
                      WebApplicationContextUtils.getWebApplicationContext(context);
              if (webApplicationContext == null) {
                  throw new IllegalStateException(
                          "ServletContext is available but WebApplicationContextUtils.getWebApplicationContext(ServletContext) returned null. Either the application context failed to load or is not yet done loading.");
              }
              return webApplicationContext;
          }
  
          return applicationContextCreator.get();
      }