/** Returns true if given scope is active in current context. */ public static <S extends Annotation> boolean isScopeActive(Class<S> scope) { BeanManager beanManager = Util.getCdiBeanManager(FacesContext.getCurrentInstance()); try { Context context = beanManager.getContext(scope); return context.isActive(); } catch (ContextNotActiveException ignore) { return false; } }