1 Reply Latest reply on Oct 29, 2012 6:31 AM by Nicklas Karlsson

    Possible to do CDI injection in custom login module?

    danpeter Newbie



      I have a custom login module that extends UsernamePasswordLoginModule


      I want to inject cdi managed beans from my application but it does not seem to work, they just stay null.

      Is this supposed to work or is there a workaround? Now i get the bean manager and inject the beans programatically.


      Bean<UserService> bean = (Bean<UserService>) bm.getBeans(UserService.class).iterator().next();

      CreationalContext<UserService> ctx = bm.createCreationalContext(bean);

      userService = (UserService) bm.getReference(bean, UserService.class, ctx);