Open shenghe opened 9 years ago
filter不受spring管理,肯定无法outwore
试试这样吧:)
WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext())
.getAutowireCapableBeanFactory()
.autowireBean(this);
dubbo本身不依赖spring,所以如果是dubbo加载filter,自然不能@autowired
这问题解决了么? Did this problem be solved?
为什么不能把fiter加到springcontext中呢?
试试这个类,应该可以解决获取bean的问题com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory
// 引用其它服务类 WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext()); //wac.getBean(RefrenceClass.class);
自定义Filter,然后通过dubbo的extension属性加载,自定义filter里面无法@Autowired,变量永远是null