code: public static BeanManager getBeanManager() {
          BeanManager mgr = getBeanManagerFromJndi();
          if (mgr == null) {
              ServiceLoader<BeanManagerProvider> loader = ServiceLoader
                  .load(BeanManagerProvider.class);
              Iterator<BeanManagerProvider> it = loader.iterator();
  
              while (mgr == null && it.hasNext()) {
                  BeanManagerProvider provider = it.next();
                  mgr = provider.getBeanManager();
              }
          }
  
          return mgr;
      }
docs: Tries to look up bean manager first from JNDI, and failing that from any service providers
  that might be registered using META-INF/services.
  
  @return bean manager, or null