You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/10/25 09:20:02 UTC
[GitHub] [dubbo] ChinaJeckXu opened a new issue #9126: Dubbo 3.0 Filter 中 获取Spring Bean 的问题。
ChinaJeckXu opened a new issue #9126:
URL: https://github.com/apache/dubbo/issues/9126
原有的 ExtensionFactory :ExtensionLoader.getExtensionLoader(ExtensionFactory.class).getAdaptiveExtension(); 方法已经废弃,请问新的方法是哪个呢?是否能给出示例?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] huangwenkan9 commented on issue #9126: Dubbo 3.0 Filter 中 获取Spring Bean 的问题。
Posted by GitBox <gi...@apache.org>.
huangwenkan9 commented on issue #9126:
URL: https://github.com/apache/dubbo/issues/9126#issuecomment-950883361
参考ExtensionInjector
关于filter中获取spring bean的问题在dubbo3.0.5中修复
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] kylixs commented on issue #9126: Dubbo 3.0 Filter 中 获取Spring Bean 的问题。
Posted by GitBox <gi...@apache.org>.
kylixs commented on issue #9126:
URL: https://github.com/apache/dubbo/issues/9126#issuecomment-955633546
> Dubbo 3.0 Filter 中 获取Spring Bean 的问题
这个问题没有详细的描述,具体是什么问题?
1、在Dubbo中获取Spring context
```java
ApplicationContext applicationContext = SpringExtensionInjector.get(applicationModel).getContext();
applicationContext.getBean(BarService.class);
```
2、在SPI中通过setter方法注入Spring bean
```
public class MyFooSPI implements FooSPI {
private BarService barService;
public void setBarService(BarService barService) {
this.barService=barService;
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] huangwenkan9 commented on issue #9126: Dubbo 3.0 Filter 中 获取Spring Bean 的问题。
Posted by GitBox <gi...@apache.org>.
huangwenkan9 commented on issue #9126:
URL: https://github.com/apache/dubbo/issues/9126#issuecomment-970396759
same problem ? #9045
@kylixs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo] kylixs commented on issue #9126: Dubbo 3.0 Filter 中 获取Spring Bean 的问题。
Posted by GitBox <gi...@apache.org>.
kylixs commented on issue #9126:
URL: https://github.com/apache/dubbo/issues/9126#issuecomment-955632726
> 原有的 ExtensionFactory :ExtensionLoader.getExtensionLoader(ExtensionFactory.class).getAdaptiveExtension(); 方法已经废弃,请问新的方法是哪个呢?是否能给出示例?
3.0.3 Dubbo支持多应用实例后,ExtensionLoader也相应的支持多实例,改成通过SPI对应ScopeModel( ApplicationModel/ModuleModel/FrameworkModel) 获取ExtensionLoader。
如Application层的一个SPI:
```java
@SPI(scope = ExtensionScope.APPLICATION)
public interface FooSPI {
...
}
```
1、加载SPI实例:
```java
ApplicationModel applicataionModel = ...;
applicataionModel.getExtensionLoader(FooSPI.class).getAdaptiveExtension();
```
2、一般是通过上下文获取到ScopeModel,如:
1) URL.getScopeModel()
2) SPI 的构造函数注入
```java
public class MyFooSPI implements FooSPI {
public MyFooSPI ( ApplicationModel applicataionModel ) {
...
}
}
```
3) DubboBootstrap
4) Spring ApplicationContext
```
DubboBeanUtils.getApplicationModel(applicationContext);
DubboBeanUtils.getModuleModel(applicationContext);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org