I am trying to autowire a bunch of dao objects in my custom servlet filter and for some reason, autowiring does work with controllers but does not work in my servlet filter. Here is my servlet filter:
and it throws a null pointer exception. Is there something special I have to do to autowire a filter versus a controller class?Code:@Component("appFilter") public class MyAppFilter implements Filter { @Autowired @Qualifier("userDao") private UserDao userDao; public void destroy() { // TODO Auto-generated method stub } public void doFilter( ServletRequest arg0, ServletResponse arg1, FilterChain arg2 ) throws IOException, ServletException { System.out.println("FILTER>>>>>>>>>>>>>>"+userDao.find( "from User" )); } public void init( FilterConfig arg0 ) throws ServletException { // TODO Auto-generated method stub } }


Reply With Quote
Sorry
