title: Spring beans not getting @autowired in Jersey ContainerRequestFilter, ContainerResponseFilter
body: <p>I have a Jersey authorization filter intended to get executed before an API call. But spring beans are not getting initialised, thus throwing <code>NullPointerException</code>.</p>
  
  <pre><code>@Provider
  @Autherization
  public class AuthorizationFilter implements ContainerRequestFilter, ContainerResponseFilter {
  
      @Autowired
      private EntityDAO&lt;SessionDO&gt; sessionDAO;
  
      @Override
      public void filter(ContainerRequestContext requestContext) throws IOException {
          String requestSessionId = requestContext.getHeaders().getFirst("SESSION_ID");
          String username = requestContext.getHeaders().getFirst("USERNAME");
          Optional&lt;SessionDO&gt; session = sessionDAO.get(requestSessionId);
          if (session.isEmpty() || session.get().getExpiryTimestamp() &lt; System.currentTimeMillis()) {
              throw new SessionExpiredException("User not logged in or session has expired");
          }
          if (!username.equals(session.get().getStudentDO().getUid())) {
              throw new InvalidUsernameException("Username is didn't match for given session id");
          }
      }
  
      @Override
      public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
  
      }
  }
  </code></pre>
  
  <p>Bean is annotated with <code>@Component</code> as following</p>
  
  <pre><code>@Component
  public class SessionDAOImpl extends EntityDAO&lt;SessionDO&gt; {
  
      @Autowired
      private DynamoDBMapper dynamoDBMapper;
  
      @Override
      public Optional&lt;SessionDO&gt; get(String id) {
          return Optional.ofNullable(dynamoDBMapper.load(SessionDO.class, id));
      }
  }
  </code></pre>
  
  <p>Why are beans not loaded into filter?</p>