All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.cdi.common.util.CDIHelper Maven / Gradle / Ivy

The newest version!
package org.infinispan.cdi.common.util;

import jakarta.enterprise.inject.spi.BeanManager;

public class CDIHelper {

   public static final boolean isCDIAvailable() {
      try {
         CDIHelper.class.getClassLoader().loadClass("jakarta.enterprise.inject.spi.BeanManager");
         return true;
      } catch(ClassNotFoundException e) {
         return false;
      }
   }

   public static final BeanManager getBeanManager() {
      try {
         return BeanManagerProvider.getInstance().getBeanManager();
      } catch (IllegalStateException ise) {
         return null;
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy