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
some
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
point)).
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
https://github.com/seam/solder/blob/master/impl/src/main/java/org/jboss/s...
for a possible implementation.
You could also create a class without a zero-arg constructor, or
create a final class.
TIA.
Andres
--
View this message in context:
http://weld-development-discussions.46994.n3.nabble.com/How-to-avoid-clas...
Sent from the Weld development discussions mailing list archive at
Nabble.com.
_______________________________________________
weld-dev mailing list
weld-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev
--
Jason Porter
http://lightguard-jp.blogspot.com
http://twitter.com/lightguardjp
Software Engineer
Open Source Advocate
Author of Seam Catch - Next Generation Java Exception Handling
PGP key id: 926CCFF5
PGP key available at:
keyserver.net,
pgp.mit.edu