You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "ZuRun (GitHub)" <gi...@apache.org> on 2018/09/28 12:53:09 UTC

[GitHub] [incubator-dubbo-spring-boot-project] ZuRun opened issue #288: @Reference 注入为null

dubbo消费方,使用了拦截器,且group为`Constants.CONSUMER`时,会导致`@Reference`注解注入失败.
```java
@Activate(group = {Constants.CONSUMER})
public class DubboFilter implements Filter{

}
```
目前只发现这种情况有问题,一下情况都正常
1. 使用`Constants.PROVIDER`的拦截器可以正常使用.
2. 消费方不使用此拦截器的时候,`@Reference`注解可以正常注入
3. 提供方拦截器是正常使用的


[ Full content available at: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/288 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo-spring-boot-project] mercyblitz closed issue #288: 消费方使用拦截器,导致@Reference 注入为null

Posted by "mercyblitz (GitHub)" <gi...@apache.org>.
[ issue closed by mercyblitz ]

[ Full content available at: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/288 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo-spring-boot-project] Jc826 commented on issue #288: 消费方使用拦截器,导致@Reference 注入为null

Posted by "Jc826 (GitHub)" <gi...@apache.org>.
> dubbo消费方,使用了拦截器,且group为`Constants.CONSUMER`时,会导致`@Reference`注解注入失败.此时消费方调用提供方时,demoService为null,抛出空指针异常.
> 
> ```java
> @Activate(group = {Constants.CONSUMER})
> public class DubboFilter implements Filter{
> 
> }
> ```
> 
> ```java
> @Reference(version = "${dubbo.service.version}")
> private DemoService demoService;
> ```
> 
> 目前只发现这种情况有问题
> 
> 1. 先启动的provider,然后启动的consumer
> 2. 使用了拦截器才会有问题
> 3. 使用`Constants.PROVIDER`的拦截器可以正常使用.
> 4. 消费方不使用此拦截器的时候,`@Reference`注解可以正常注入
> 5. 提供方拦截器是正常使用的

@Reference(check=false)

[ Full content available at: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/288 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo-spring-boot-project] mercyblitz commented on issue #288: 消费方使用拦截器,导致@Reference 注入为null

Posted by "mercyblitz (GitHub)" <gi...@apache.org>.
Please add  Dubbo 2.6.5  in order to override indirectly dependencies:
```xml
<dependency>
    <groupId>com.alibaba.boot</groupId>
    <artifactId>dubbo-spring-boot-starter</artifactId>
    <version>0.2.0</version>
</dependency>

<!-- Dubbo -->
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>dubbo</artifactId>
    <version>2.6.5</version>
</dependency>
<!-- Spring Context Extras -->
<dependency>
    <groupId>com.alibaba.spring</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>1.0.2</version>
</dependency>
```

There was a legacy issue in Dubbo.

[ Full content available at: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/288 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org