Awesome, thanks for the clarification! Sincerely,
Joe On Tue, Jan 19, 2010 at 8:31 AM, Gurkan Erdogdu <cgurkanerdo...@gmail.com>wrote: > Yes, it works! I have tried it. > > 2010/1/19 Joseph Bergmark <bergm...@gmail.com> > > > Lets ignore the @Inject @Named for a minute, as I think it is distracting > > from the main issue of the producer methods default name. > > > > If I have a bean with a producer field: > > > > @Produces @Named Products getProducts() > > > > You would agree its el-name should be "products" and I should be able to > > reference it in a EL-expression as "products". For example > > > > <h:outputText value="#{products"/>? > > > > I'll give this a try later today to be sure it works. > > > > Sincerely, > > > > Joe > > > > On Tue, Jan 19, 2010 at 2:33 AM, Gurkan Erdogdu < > cgurkanerdo...@gmail.com > > >wrote: > > > > > As specified in specification, this is solely used for integration with > > > legacy code that uses @Named annotation as differentiating beans with > > > strings. For example,if you use JSR-330 impl and @Named(value), to > > > differentiate beans, you could resolve those beans with JSR-299 using > > > @Named(value). So using value annotation member is required for > injection > > > points that use @Named annotation as qualifiers > > > > > > I have also tried this via Weld, it does not work with too. But if you > > add > > > @Named("products") into producer method, it works like in OWB! > > > > > > Thanks; > > > > > > --Gurkan > > > > > > > > > 2010/1/19 Gurkan Erdogdu <cgurkanerdo...@gmail.com> > > > > > > > Joe, you are right that producer method name is getting from method > > name > > > > if there is no Named(value). > > > > > > > > In the example, default name of the producer bean is "products." > There > > is > > > > no problem in this. The problem is how to resolve this producer > method. > > > In > > > > the example, tried with qualifiers, public @Inject @Named("products") > > > String > > > > N3;. This does not work because there is no bean with qualifier > > > > @Named("products"). In other words, this producer method has a > > Qualifier > > > > "@Named(value=)" and name is "products". > > > > > > > > If you get producer method bean with name, as such, > > > > BeanManager.getBeans("products"), it works! > > > > > > > > Thanks; > > > > > > > > 2010/1/18 Joseph Bergmark <bergm...@apache.org> > > > > > > > > While I agree that injecting using the @Name with the String value > > isn't > > > >> recommended, it works right now. > > > >> > > > >> That said, section 3.3.8 seems to clearly indicate that the @Named > > > >> qualifier > > > >> for a producer method should provide a default value that follows > > > JavaBean > > > >> property getter names. IE a method named getProducts() should get > the > > > >> default name (if annotated with @Named) of "products" and not > > > >> "getProducts" > > > >> which appears to be what is happening now. > > > >> > > > >> I do not believe this Issue is invalid, but perhaps I am misreading > > > 3.3.8? > > > >> > > > >> Sincerely, > > > >> > > > >> Joe > > > >> > > > >> On Mon, Jan 18, 2010 at 4:10 PM, Gurkan Erdogdu (JIRA) < > > j...@apache.org > > > >> >wrote: > > > >> > > > >> > > > > >> > [ > > > >> > > > > >> > > > > > > https://issues.apache.org/jira/browse/OWB-239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel > > > >> ] > > > >> > > > > >> > Gurkan Erdogdu closed OWB-239. > > > >> > ------------------------------ > > > >> > > > > >> > Resolution: Invalid > > > >> > > > > >> > This is true action. @Named is a qualifier. You have to give it a > > > >> > @Named(value) in producer method. So you have to define producer > > > method > > > >> as > > > >> > > > > >> > @Produces > > > >> > @Named("products") > > > >> > public String getProducts() > > > >> > { > > > >> > return "Sucess from getProducts"; > > > >> > } > > > >> > > > > >> > @Named value does not get producer method name automatically. > > > >> > > > > >> > Also using @Named with string members are not recommended usage. > See > > > >> > specification 3.11. The qualifier @Named at injection points > > > >> > > > > >> > > > > >> > > JavaBeans property getter naming convention with Producer > Methods > > > >> gives > > > >> > UnsatisfiedResolutionException > > > >> > > > > > >> > > > > >> > > > > > > ------------------------------------------------------------------------------------------------------ > > > >> > > > > > >> > > Key: OWB-239 > > > >> > > URL: > > https://issues.apache.org/jira/browse/OWB-239 > > > >> > > Project: OpenWebBeans > > > >> > > Issue Type: Bug > > > >> > > Components: Injection and Lookup > > > >> > > Affects Versions: M3 > > > >> > > Environment: Windows, Eclipse running Jetty > > > >> > > Reporter: Bill Wigger > > > >> > > Assignee: Gurkan Erdogdu > > > >> > > Fix For: M3 > > > >> > > > > > >> > > > > > >> > > Problem: > > > >> > > JavaBeans property getter naming convention with Producer > Methods > > > >> gives > > > >> > UnsatisfiedResolutionException > > > >> > > Injection in class X: > > > >> > > @Produces @Named public String getProducts() { > > > >> > > return "Sucess from getProducts"; > > > >> > > } > > > >> > > Injection Point in Y: > > > >> > > public @Inject @Named("products") String N3; > > > >> > > public String getTestNamed3() { > > > >> > > String y = N3; > > > >> > > return y; > > > >> > > } > > > >> > > Actual Results when getTestNamed3 is called from a JSP: > > > >> > > javax.enterprise.inject.UnsatisfiedResolutionException: Api type > > > >> > [java.lang.String] is not found with the qualifiers > > > >> > [...@javax.inject.named(value=products)] > > > >> > > at > > > >> > > > > >> > > > > > > org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:93) > > > >> > > at > > > >> > > > > >> > > > > > > org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:232) > > > >> > > at > > > >> > > > > >> > > > > > > org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.java:90) > > > >> > > etc.... > > > >> > > > > > >> > > Desired Results: > > > >> > > "Sucess from getProducts" > > > >> > > > > >> > -- > > > >> > This message is automatically generated by JIRA. > > > >> > - > > > >> > You can reply to this email to add a comment to the issue online. > > > >> > > > > >> > > > > >> > > > > > > > > > > > > > > > > -- > > > > Gurkan Erdogdu > > > > http://gurkanerdogdu.blogspot.com > > > > > > > > > > > > > > > > -- > > > Gurkan Erdogdu > > > http://gurkanerdogdu.blogspot.com > > > > > > > > > -- > Gurkan Erdogdu > http://gurkanerdogdu.blogspot.com >