docs: public static boolean isCDIAvailable(ExternalContext externalContext)
      {
          if (cdiAvailable == null)
          {
              try
              {
                  cdiAvailable = Class.forName("javax.enterprise.inject.spi.BeanManager") != null;
              }
              catch (Throwable t)
              {
                  //log.log(Level.FINE, "Error loading class (could be normal)", t);
                  cdiAvailable = false;
              }
              
              if (cdiAvailable)
              {
                  cdiAvailable = externalContext.getApplicationMap().containsKey(
                      "oam.cdi.BEAN_MANAGER_INSTANCE");
              }
  
              log.info("MyFaces CDI support " + (cdiAvailable ? "enabled" : "disabled"));
              
              return cdiAvailable;
          }
          else
          {
              if (Boolean.TRUE.equals(cdiAvailable))
              {
                  return externalContext.getApplicationMap().containsKey(
                          "oam.cdi.BEAN_MANAGER_INSTANCE");
              }
              return cdiAvailable;
          }        
      }