[GLASSFISH-18046] @Inject @New Instance<SomeClass> not working, getting WELD-001308 Unable to resolve any beans for Types Created: 19/Dec/11 Updated: 21/Mar/13 Resolved: 21/Mar/13
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
Windows 7 64-Bit
see also similar issue for JBoss7: https://issues.jboss.org/browse/WELD-975
According to spec: "...the @New qualifier may be used, allowing the application to obtain a @New qualified bean, as defined in Section 3.12, @New qualified beans" (CDI 1.0; chapter 5.6. Programmatic lookup).
However using programmatic lookup with @New qualifier like:
after trying to obtain reference via get() method.
Following code works ok:
Spec gives following valid example:
|Comment by Sivakumar Thyagarajan [ 04/Jan/12 ]|
Could you please submit a reproducible test case? I tried to reproduce this scenario in a developer test
At first glance, this appears to be a WELD issue, and hence I will track the resolution of WELD-795 for this.
|Comment by chrikru [ 05/Jan/12 ]|
I ran the test case locally and it worked fine for me to. So I tried to reproduce my error and succeeded. After some more analysis of the problem, I found something interesting:
It seems, that if the bean, which is used via "@Inject @New Instance<Bean>", was injected before via "@Inject @New Bean", the case with "Instance" is working. Otherwise it fails.
|Comment by Sivakumar Thyagarajan [ 10/Dec/12 ]|
Transferring to JJ Snyder
|Comment by tlcksnyder [ 21/Mar/13 ]|
Fixed in Weld as of 1.1.9.Final, 1.2.0.Beta1, 2.0.0.Alpha3.