-
1. Re: why @Inject @Named is not working
asiandub Sep 3, 2010 6:28 AM (in response to nimo22)
But I want to reference findUser have to use the @Named@Named is a annotation for bean construction, not for bean injection. Using it with @Inject doesn't make sense.
@Produces @Named Users findUser;
is what you are looking for...
-
2. Re: why @Inject @Named is not working
nimo22 Sep 3, 2010 6:44 AM (in response to nimo22)hello,
@Named is a annotation for bean construction, not for bean injection.got it. thanks.
(it works with produces)
-
3. Re: why @Inject @Named is not working
nickarls Sep 3, 2010 6:56 AM (in response to nimo22)Actually @Named at injection points is OK but as the spec says
The use of @Named as an injection point qualifier is not recommended, except in the case of integration with legacy code that uses string-based names to identify beans.
-
4. Re: why @Inject @Named is not working
nimo22 Sep 3, 2010 7:02 AM (in response to nimo22)Hello Nicklas,
thanks I red that. So this
@Inject @New @Named("hello") bean;
is the same as seams 2:
@In(create=true) bean;
with el:
#{bean}
Am I right?
-
5. Re: why @Inject @Named is not working
nickarls Sep 3, 2010 7:06 AM (in response to nimo22)Well you always have something injected (or a deployment error) so there is no create=true equivalence. And to use
#{bean}
you need to have@Produces @Named X bean
somewhere.
-
6. Re: why @Inject @Named is not working
xsalefter.xsalefter.yahoo.com Sep 3, 2010 11:12 AM (in response to nimo22)Hmmm.. I think @Produces @Named X bean is a replacement for @Out in seam. No? And if @Produces @Named is not recommended, how to do it in
recommended
way? -
7. Re: why @Inject @Named is not working
nickarls Sep 3, 2010 11:13 AM (in response to nimo22)nothing wrong with @Produces @Named, it's for EL exposure. It's the injection thats not recommended (inter-bean injection)
-
8. Re: why @Inject @Named is not working
andygibson.contact.andygibson.net Sep 9, 2010 12:27 AM (in response to nimo22)@Produces is more a replacement for the @Factory annotation. Strictly speaking, there is no outjection anymore.
Named is OK for producing beans, it is required for exposing objects to EL. However, the plan is to use more type safe qualifiers for matching injection points instead of type unsafe string based names.
Cheers,
Andy Gibson