springboot dubbo filter之依赖注入null

@Autowired
private ICallerRepository callerRepository;
...
//用dubbo提供的ServiceBean即可获取bean,因为该类已经实现了ApplicationContextAware
ApplicationContext context= ServiceBean.getSpringContext();
callerRepository = context.getBean(ICallerRepository.class);
必须通过ApplicationContext来获取,因为Filer不在Spring的管理下,无法注入
posted @ 2018-08-30 10:40  纯洁的赤子之心  阅读(1644)  评论(0编辑  收藏  举报