docs: protected void configureAndRefreshPortletApplicationContext(ConfigurablePortletApplicationContext pac, PortletContext pc) {
          if (ObjectUtils.identityToString(pac).equals(pac.getId())) {
              // The application context id is still set to its original default value
              // -> assign a more useful id based on available information
              String idParam = pc.getInitParameter(CONTEXT_ID_PARAM);
              if (idParam != null) {
                  pac.setId(idParam);
              }
              else {
                  // Generate default id...
                  pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
                          ObjectUtils.getDisplayString(pc.getPortletContextName()));
              }
          }
  
          // Determine parent for root web application context, if any.
          ApplicationContext parent = loadParentContext(pc);
  
          pac.setParent(parent);
          pac.setPortletContext(pc);
          String initParameter = pc.getInitParameter(CONFIG_LOCATION_PARAM);
          if (initParameter != null) {
              pac.setConfigLocation(initParameter);
          }
          else {
              try {
                  pac.setConfigLocation("/WEB-INF/portletApplicationContext.xml");
              }
              catch (UnsupportedOperationException e) {
                  //Ignore, may get triggered if the context doesn't support config locations
              }
          }
          customizeContext(pc, pac);
          pac.refresh();
      }