标签:style http io color ar os java sp on
Try:
UsersConnectionRepository bean = (UsersConnectionRepository)WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext()).getBean("usersConnectionRepository");
Where usersConnectionRepository is a name/id of your bean in the application context. Or even better:
UsersConnectionRepository bean = WebApplicationContextUtils.getRequiredWebApplicationContext(filterConfig.getServletContext()).getBean(UsersConnectionRepository.class);
Also have a look at GenericFilterBean
How to get a Spring bean in a Servlet filter?
标签:style http io color ar os java sp on
原文地址:http://my.oschina.net/sunpr/blog/340966