Injecting ApplicationScoped bean into Web Filter results in null object

21 views Asked by At

I have the following ApplicationScoped bean

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;   
@Named
@ApplicationScoped
public class UserService implements Serializable {...

And I am trying to inject it into a web filter

import javax.inject.Inject;
import javax.servlet.Filter;
@WebFilter("/admin/*")
public class AdminFilter implements Filter{

@Inject
private UserService userService;

The injected userService is null in the doFilter method. I can't figure out what I am missing. Thanks in advance!

0

There are 0 answers