/** * javax.faces.bean.ViewScoped is no CDI Scope. * We need to add it programmatically to CDI. */ public void addViewScoped(@Observes BeforeBeanDiscovery beforeBeanDiscovery) { isActivated = ClassDeactivationUtils.isActivated(getClass()); if (isActivated) { //this extension is only needed if the cdi-based view-scope handling isn't delegated to jsf 2.2+ isActivated = !JsfUtils.isViewScopeDelegationEnabled(); } if (!isActivated) { return; } beforeBeanDiscovery.addScope(ViewScoped.class, true, true); }
/** * Ignore ViewScoped, SessionScoped, RequestScoped and NoneScoped annotations * because spring will take care of them. * @return set of annotations to exclude from handlesType */ private Set<Class<? extends Annotation>> annotationsToExclude() { Set<Class<? extends Annotation>> result = new HashSet<>(); if (this.jsfAnnotatedClassFactoryConfiguration.isExcludeScopedAnnotations()) { result.add(ViewScoped.class); result.add(SessionScoped.class); result.add(RequestScoped.class); result.add(NoneScoped.class); } return result; }
public void addScope(@Observes final BeforeBeanDiscovery event) { event.addScope(ViewScoped.class, true, true); }
@Override public Class<? extends Annotation> getScope() { return ViewScoped.class; }
/** * {@inheritDoc} */ @Override public Class<? extends Annotation> getScope() { return ViewScoped.class; }