jeudi 11 juin 2015

struts 1.x Cannot inject javaee 7 bean into struts action

I have came across another question on stackoverflow. It seems that in java ee 6 it was impossible to inject beans into struts actions.

I do not know if it is the same in java ee 7, so I tried testing:

@RequestScoped
public class LoginAction extends Action {

    @Inject
    private UserDao userDao;

    ...

}

But it didn't work. userDao is null.

So my question is, if it is possible to inject a bean into struts action. If yes then how, if no then why?

Thanx

Aucun commentaire:

Enregistrer un commentaire