springmvc中filter怎么注入service
展开全部
获取applicationContext,然后自己加载bean。
ServletContext context = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils
.getWebApplicationContext(context);
ArticleInfoService articleinfoService = (ArticleInfoService) ctx
.getBean("yourServiceName");
ServletContext context = request.getSession().getServletContext();
ApplicationContext ctx = WebApplicationContextUtils
.getWebApplicationContext(context);
ArticleInfoService articleinfoService = (ArticleInfoService) ctx
.getBean("yourServiceName");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询