完美解决Spring@Autowired无法注入AbstractInterceptor

今天在使用AbstractInterceptor拦截时,发现Spring@Autowired无法注入,返回结果为null。捣腾了下,手动配置了下,完美解决。直接上图

首先建立一个获取工厂的帮助类:

完美解决Spring@Autowired无法注入AbstractInterceptor_第1张图片

在application配置文件配置我们要用的bean:


配置好后,直接调用:


好了,该写下一个bug了。。。。。。




你可能感兴趣的:(完美解决Spring@Autowired无法注入AbstractInterceptor)