users@glassfish.java.net

Re: CDI question

From: <glassfish_at_javadesktop.org>
Date: Wed, 16 Jun 2010 06:57:12 PDT

Hi

> This one is not Glassfish-specific, but a good number
> of Java EE 6 developers hang out here and nowhere
> else, so I hope you'll forgive the off-topic post.
> Where is the best place, in the community's opinion,
> to declare CDI resources?
> Many examples show this sort of thing occurring in
> one "special" class.
> My question is: is this appropriate? Where do you
> all define your CDI resources? I was thinking about
> putting them in a single class per package or
> deployment module named something like CDIResources.

As the stackoverflow.com response also indicated, this is really a style issue. This "utility" class that maps string-based Java EE component references to type-safe (with optional qualifiers) injectable dependencies can be placed anywhere within your module (Your module must be a bean archive). However since this class could be deployment specific, this utility class is recommended to be an alternative. (annotated with @Alternative) as discussed in the end of section 14.1 in http://docs.jboss.org/weld/reference/1.0.1-Final/en-US/html/resources.html#d0e4587.

Thanks
--Siva.
[Message sent by forum member 'sivakumart']

http://forums.java.net/jive/thread.jspa?messageID=474497