dangdangdotcom / dubbox

Dubbox now means Dubbo eXtensions, and it adds features like RESTful remoting, Kyro/FST serialization, etc to the Dubbo service framework.
http://dangdangdotcom.github.io/dubbox
Apache License 2.0
4.9k stars 2.06k forks source link

Filter里无法@Autowired #47

Open shenghe opened 9 years ago

shenghe commented 9 years ago

自定义Filter,然后通过dubbo的extension属性加载,自定义filter里面无法@Autowired,变量永远是null

li-shen commented 9 years ago

filter不受spring管理,肯定无法outwore

doukai commented 8 years ago

试试这样吧:)
WebApplicationContextUtils.getRequiredWebApplicationContext(sce.getServletContext()) .getAutowireCapableBeanFactory() .autowireBean(this);

reven404 commented 8 years ago

see: DelegatingFilterProxy

orika commented 8 years ago

dubbo本身不依赖spring,所以如果是dubbo加载filter,自然不能@autowired

MarsYoung commented 8 years ago

这问题解决了么? Did this problem be solved?

MarsYoung commented 8 years ago

为什么不能把fiter加到springcontext中呢?

skysoul1985 commented 8 years ago

试试这个类,应该可以解决获取bean的问题com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory

dusonchen commented 8 years ago

// 引用其它服务类 WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext()); //wac.getBean(RefrenceClass.class);