dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

升级版本后原先扩展Filter的代码,setter注入的属性为空

Open shuohao opened this issue 3 years ago • 4 comments

对比了一下dubbo版本代码后发现SpringExtensionInjector
image 原先代码是先根据name查询bean,查不到再根据类型type去查找,但是新版的只要name不为空就不会根据type去查即便查不到,比如我们这个原先代码 image 注入了applicationConfig和providerConfig,根据applicationConfig查不到因为我们配置了dubbo.application.name项目名,所以注入的属性为空,执行createRouter时候这里代码就会报空指针。这里想兼容升级的话怎么弄好

shuohao avatar Oct 21 '22 08:10 shuohao

1.要确认 spring 容器中已经注入了 ApplicationConfig 类型的类 2.查看注入容器中时对应的 key 是什么 3.如果确认在容器中存在 可以把 set 方法 setxxx xxx 替换为容器中对应类的 key 的名称

liufeiyu1002 avatar Oct 22 '22 14:10 liufeiyu1002

1.要确认 spring 容器中已经注入了 ApplicationConfig 类型的类 2.查看注入容器中时对应的 key 是什么 3.如果确认在容器中存在 可以把 set 方法 setxxx xxx 替换为容器中对应类的 key 的名称

1.已经注入了 2.key是业务名称 3.因为提供的是扩展starter,没法写死

shuohao avatar Oct 24 '22 02:10 shuohao

1.要确认 spring 容器中已经注入了 ApplicationConfig 类型的类 2.查看注入容器中时对应的 key 是什么 3.如果确认在容器中存在 可以把 set 方法 setxxx xxx 替换为容器中对应类的 key 的名称

1.已经注入了 2.key是业务名称 3.因为提供的是扩展starter,没法写死

大佬,你是想要name可以从'beanFactory'获得对象是吗?

githublaohu avatar Nov 18 '22 01:11 githublaohu

please assign to me

samyScott avatar Jan 30 '23 09:01 samyScott