This CDI extension should tell the CDI implementation to register from the org.omnifaces package only the classes from org.omnifaces.cdi and org.omnifaces.showcase subpackages as CDI managed beans.
Weld 2.x will during startup log a warning like below on this class:
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
First of all, this warning is harmless. We are aware of this and we won't take further action in order to ensure compatibility of OmniFaces on as many containers as possible.
By default, CDI capable containers attempt to register every single class in every single JAR in
/WEB-INF/lib as a CDI managed bean. In older CDI versions as used by older Java EE 6 containers, there
were bugs whereby the CDI implementation even attempts to register enums, abstract classes and/or classes without a
default constructor, resulting in deployment exceptions (WebLogic), runtime exceptions (WebSphere) and/or loads of
confusing warnings (GlassFish/TomEE).
In order to solve that, OmniFaces added this
VetoAnnotatedTypeExtension which should "veto" any class from
org.omnifaces package which is not in either
org.omnifaces.showcase package from being registered as a CDI managed bean. This happens via
In Weld 2.x as used in among others WildFly, there's apparently a new type of warning which occurs when you use
ProcessAnnotatedType on all classes. However, in this specific case, it's just the whole
purpose to scan every single class, because classes which needs to be excluded from being registered as CDI managed
beans are obviously not explicitly registered as a CDI managed bean (for which you could otherwise use a more
@WithAnnotations as suggested in the warning message).
Theoretically, the solution in this specific case would be to use
beans.xml instead of an
Extension. However, this is
not a standard CDI solution as this is Weld-specific and thus wouldn't work with other CDI implementations such as
OpenWebBeans or CanDI. We couldn't figure a similar mechanism for other CDI implementations, so we went for the
After all, again, this is "just" a warning, not an error. Everything should continue to work as intented.
|Constructor and Description|
Copyright © 2012–2016 OmniFaces. All rights reserved.