Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
4649 | minor | always | 07-01-11 13:22 | 07-05-11 09:50 | |
|
|||||
Reporter: | reza | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 4.0.19 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 4.0.20 | ||
|
|||||
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: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|