-
Bug
-
Resolution: Done
-
Critical
-
2.3.4.Final
-
None
There's multimodule project with producer in dependency jar which produces bean with qualifier annotation. This bean should be injected in main module.
Weld is initialized using org.jboss.weld.environment.servlet.Listener:
public class Main { public static void main(String[] args) throws Exception { ServletContextHandler handler = new ServletContextHandler(); handler.addEventListener(new Listener()); handler.addServlet(Consumer.class, "/*"); Server server = new Server(8080); server.setHandler(handler); server.start(); server.join(); } }
Servlet code:
@ApplicationScoped public class Consumer extends HttpServlet { @Inject @BindingAnnotation private String s; public String t() { return "test: " + s; } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType("text/plain"); resp.getWriter().write(t()); } }
Other jar contains producer for @BindingAnnotation String:
@ApplicationScoped public class Producer { @Produces @BindingAnnotation public String get() { return "test"; } }
Same project works fine with weld-servlet-core 2.3.3.Final. Demo project is published at https://github.com/grossws/weld-bug-qualifier-inject.git, see Steps to Reproduce