[weld-issues] [JBoss JIRA] Closed: (WELD-354) Value-less @Named annotation of producer methods has no impact

Pete Muir (JIRA) jira-events at lists.jboss.org
Wed Jan 6 12:59:30 EST 2010


     [ https://jira.jboss.org/jira/browse/WELD-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pete Muir closed WELD-354.
--------------------------

    Resolution: Partially Completed


There are a number of problems with the bug as reported.

1) The requested injections for the producer method don't exist, as the producer fields aren't named (in my test case I added a qualifier to each producer field, and injected using that not names)
2) The names of the producer methods were {getErrorQueueTemplate, getLogQueueTemplate}, not {errorQueueTemplate, logQueueTempalte}. The bug report describes them being set to the bean id, which was not the case. Note that the name was only wrong if the producer method had injected parameters
3) You *should* get an ambiguous resolution exception for the injection performed in the bug - the name defaulting has *no* effect on the use of @Named as a qualifier, only for resolution by name (this is perhaps a little confusing tho?).

Anyway, I fixed the bug I did find, but the bug as reported is invalid and so not fixed.

> Value-less @Named annotation of producer methods has no impact
> --------------------------------------------------------------
>
>                 Key: WELD-354
>                 URL: https://jira.jboss.org/jira/browse/WELD-354
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.0.0.GA
>         Environment: Mac OS, Java SE engine bootstrapped from weld-test
>            Reporter: Johan Eltes
>            Assignee: Pete Muir
>            Priority: Critical
>             Fix For: 1.0.1.CR1
>
>
> The following producer methods create beans named 
> {org.jboss.weld.bean-se-module-ProducerMethod-se.callistaenterprise.cadec2010.cdi.javase.basic.JmsTemplateConfigurationProducer.getLogQeueTemplate(int), org.jboss.weld.bean-se-module-ProducerMethod-se.callistaenterprise.cadec2010.cdi.javase.basic.JmsTemplateConfigurationProducer.getErrorQeueTemplate(int)}
> rather than
> {logQeueTemplate, errorQeueTemplate}.
> As a consequence injection fails at the following injection point:
> private @Inject @Named JmsTemplate errorQeueTemplate;
> The producer methods:
> public class JmsTemplateConfigurationProducer {
> 	@Produces
> 	int longReceiveTimeout = 3 * 3600;
> 	@Produces
> 	int shortReceiveTimeout = 100;
> 	@Produces
> 	@Named
> 	public JmsTemplate getErrorQeueTemplate(
> 			@Named("longReceiveTimeout") int receiveTimeout) {
> 		JmsTemplate tmp = new JmsTemplate();
> 		tmp.setReceiveTimeout(receiveTimeout);
> 		return tmp;
> 	}
> 	@Produces
> 	@Named
> 	public JmsTemplate getLogQeueTemplate(
> 			@Named("shortReceiveTimeout") int receiveTimeout) {
> 		JmsTemplate tmp = new JmsTemplate();
> 		tmp.setReceiveTimeout(receiveTimeout);
> 		return tmp;
> 	}
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list