[jboss-jira] [JBoss JIRA] Commented: (JBAS-8818) CDI injection not working in WebListeners

Nicklas Karlsson (JIRA) jira-events at lists.jboss.org
Thu Jan 20 02:06:49 EST 2011


    [ https://issues.jboss.org/browse/JBAS-8818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576694#comment-12576694 ] 

Nicklas Karlsson commented on JBAS-8818:
----------------------------------------

OK, I'm backing out of the general injection problem since I can't reproduce it myself either, but the singleton scenario is

@WebListener
public class BadWebListener implements ServletRequestListener
{
   @Inject
   BadSingleton bs;
   
   @Override
   public void requestDestroyed(ServletRequestEvent arg0)
   {
   }

   @Override
   public void requestInitialized(ServletRequestEvent arg0)
   {
      System.out.println(">>>>BS is " + bs);
   }
}


@Singleton
public class BadSingleton
{

}

Giving

>>>>BS is null

on requests. I see the BadSingleton binding OK.

> CDI injection not working in WebListeners
> -----------------------------------------
>
>                 Key: JBAS-8818
>                 URL: https://issues.jboss.org/browse/JBAS-8818
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Weld/CDI
>    Affects Versions: 6.0.0.Final
>            Reporter: Nicklas Karlsson
>            Assignee: Marius Bogoevici
>
> CDI injection is not performed for WebListeners, e.g.
> @WebListener
> public class BugListener implements HttpSessionListener
> {
>    @Inject
>    BeanManager beanManager;
>    ...
> }
> Will have beanManager==null when the methods are hit

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list