[jboss-jira] [JBoss JIRA] (WFLY-8693) @Resource not working on Dynamic Servlets
Matej Novotny (JIRA)
issues at jboss.org
Thu May 4 06:06:00 EDT 2017
[ https://issues.jboss.org/browse/WFLY-8693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401838#comment-13401838 ]
Matej Novotny commented on WFLY-8693:
-------------------------------------
I took a glance at this and I think it would make sense if it behaved equally to static servlets in this regard - e.g. if the injection should work.
The specification (3.1 servlet spec, section 4.4.3.5) mentions something along these lines, although it's blurred as they use inappropriate wording - from CDI standpoints, servlet cannot be a managed bean, instead it's non contextual instance.
Implementation-wise, I did some digging as well, but came up empty handed. All I know is that Weld subsystem does *not* provide the injection for static servlets as can be seen in [{{InjectionTargets}}|https://github.com/wildfly/wildfly/blob/master/weld/subsystem/src/main/java/org/jboss/as/weld/injection/InjectionTargets.java#L81]. It in fact skips it on purpose (btw it can be set here which will make it work, but finding out if the class is a dynamic servlet is messy at best).
Perhaps [~swd847] can provide some directions.
> @Resource not working on Dynamic Servlets
> -----------------------------------------
>
> Key: WFLY-8693
> URL: https://issues.jboss.org/browse/WFLY-8693
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 10.1.0.Final
> Reporter: Dan Siviter
>
> When a dynamic servlet is used then {{@Resource}} does not work. When using {{@WebServlet}} it does inject fine and only appears to be associated with dynamic ones. Test used {{ManagedExecutorService}} but it may apply to more.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list