Springboot 在Filter 中通过@Autowired注入Bean,打包war部署为空值解决

ServletContext context = request.getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
DbUtilTpl dbUtilTpl = ctx.getBean(DbUtilTpl.class);

 

posted @ 2021-06-04 13:23  yshy  阅读(210)  评论(0编辑  收藏  举报