I'm developing an REST application using Glassfish 4.0.
In resource classes I can get injection to work by making the class @Stateless and injecting via @EJB (injected class is an stateless EJB).
However this approach does not work in an JAX-RS filter. I cannot get injection to work at all.
See code below:
@Provider
public class UpdateFilter implements ContainerRequestFilter {
@EJB
private MyBeanInterface doStuffBean;
@Override
public void filter(ContainerRequestContext requestContext) {
...
}
}
doStuffBean is always null.
Any suggestions?