On Wed, Mar 9, 2011 at 09:03, aalmiray <aalmiray(a)yahoo.com> wrote:
Hello guys. I'm new to Weld and CDI, perhaps the subject of this
message is a
bit obvious to some of you but for the life of me couldn't find a portable
solution to the following problem: Weld will pick up all classes of an
application (found in a single jar that contains an empty beans.xml file),
however I would like the container to cherry pick a set of classes based on
some criteria (package name, class name convention, annotation, etc).
I've seen that Weld has an extension (non-standard) that allows classes to
be annotated with @Veto. It works fine but it poses to additional problems:
- @Veto is Weld specific
The annotation is specific to Weld (hopefully will make it into the
CDI 1.1 spec), but the way it works is not.
- you must annotate each class explicitly, which causes trouble with
classes I have in my app as they are Groovy scripts, thus I can't annotated
them (Groovy script do get compiled to class files but you don't actually
'see' the class definition, it is generated by the compiler, thus the
annotation could only be added by a compiler plugin that rewrites the
generated AST (yes, it can be done but it's a heck of a Yak shaving at this
So, is there a way to specify which classes should be included/excluded in a
more generic, standard way?
You could create an extension (which is what @Veto uses) to veto a
class from being picked up at deploy time. See
for a possible implementation.
You could also create a class without a zero-arg constructor, or
create a final class.
View this message in context:
Sent from the Weld development discussions mailing list archive at Nabble.com
weld-dev mailing list
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling
PGP key id: 926CCFF5
PGP key available at: keyserver.net