springboot解决拦截器无法调用service层问题(无法注入serivce)
拦截器:
if (loginTickerService == null) {//解决service为null无法注入问题
System.out.println("loginTickerService is null!!!");
BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
loginTickerService = (LoginTickerService) factory.getBean("loginTickerService");
}
//根据token往数据库里查询token是否存在
LoginTicket chauxntoken=loginTickerService.chaxunByLoginTicket(token);