Anonymous | Login | Signup for a new account | 12-17-2024 11:41 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0004649 | [Resin] | minor | always | 07-01-11 13:22 | 07-05-11 09:50 | ||||
Reporter | reza | View Status | public | ||||||
Assigned To | ferg | ||||||||
Priority | normal | Resolution | fixed | Platform | |||||
Status | closed | OS | |||||||
Projection | none | OS Version | |||||||
ETA | none | Fixed in Version | 4.0.20 | Product Version | 4.0.19 | ||||
Product Build | |||||||||
Summary | 0004649: Using InjectionPoint effects bean resolution for Producers | ||||||||
Description |
Using InjectionPoint incorrectly effects bean resolution for Producers. It appears that Producers with InjectionPoints are given higher priority over Producers without InjectionPoints. In the following example, the BarBean is resolved for injection when FooBean should be resolved: ================================================================================ @WebServlet(urlPatterns = { "/" }) public class TestServlet extends HttpServlet { @Inject private TestBean bean; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.println(bean.getData()); writer.close(); } } ================================================================================ ================================================================================ @Entity public interface TestBean { public String getData(); } ================================================================================ ================================================================================ public class FooBean implements TestBean { @Override public String getData() { return "foo"; } } ================================================================================ ================================================================================ public class BarBean implements TestBean { @Override public String getData() { return "bar"; } } ================================================================================ ================================================================================ @Qualifier @Retention(RUNTIME) @Target({ METHOD, FIELD, PARAMETER, TYPE }) public @interface BarQualifier { } ================================================================================ ================================================================================ public class TestBeanFactory { @Produces public TestBean getFoo() { return new FooBean(); } @Produces @BarQualifier public TestBean getBar(InjectionPoint injectionPoint) { return new BarBean(); } } ================================================================================ Injection resolves correctly if both producers have injection points: ================================================================================ public class TestBeanFactory { @Produces public TestBean getFoo(InjectionPoint injectionPoint) { return new FooBean(); } @Produces @BarQualifier public TestBean getBar(InjectionPoint injectionPoint) { return new BarBean(); } } ================================================================================ Injection also resolves correctly if neither producers have injection points: ================================================================================ public class TestBeanFactory { @Produces public TestBean getFoo() { return new FooBean(); } @Produces @BarQualifier public TestBean getBar() { return new BarBean(); } } ================================================================================ This issue was originally reported by Max Bureck: http://forum.caucho.com/showthread.php?t=27986. [^] |
||||||||
Steps To Reproduce | |||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |