标签:print web gets system context factor webapp 无法 int
if (redisUtils == null) {//解决service为null无法注入问题
System.out.println("redisUtils is null!!!");
BeanFactory factory = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getServletContext());
redisUtils = (RedisUtils) factory.getBean("redisUtils");
}
原因:拦截器加载的时间点在springcontext之前,所以在拦截器中注入自然为null
标签:print web gets system context factor webapp 无法 int
原文地址:https://www.cnblogs.com/rock-turf/p/9237405.html