You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by al...@apache.org on 2021/09/08 02:48:41 UTC
[dubbo-samples] branch master updated: [NPE] Fix the reference of
demoService is null (#361)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 672d571 [NPE] Fix the reference of demoService is null (#361)
672d571 is described below
commit 672d571206853b77a16b00dafc222a8c425d6db2
Author: plusmancn <pl...@gmail.com>
AuthorDate: Wed Sep 8 10:48:38 2021 +0800
[NPE] Fix the reference of demoService is null (#361)
* fix: the reference of demoService is null
* chore: add comment on demoService.sayHello
---
.../org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
index b6c4028..4423f38 100644
--- a/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
+++ b/dubbo-samples-spring-boot-hystrix/src/main/java/org/apache/dubbo/spring/boot/consumer/ConsumerApplication.java
@@ -18,6 +18,7 @@ package org.apache.dubbo.spring.boot.consumer;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.apache.dubbo.spring.boot.api.HelloService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -28,6 +29,7 @@ import org.springframework.stereotype.Service;
@SpringBootApplication
@Service
@EnableHystrix
+@EnableDubbo
public class ConsumerApplication {
@DubboReference(version = "1.0.0")
@@ -44,6 +46,7 @@ public class ConsumerApplication {
@HystrixCommand(fallbackMethod = "reliable")
public String doSayHello(String name) {
+ // According to author's original purpose, the fallbackMethod is triggered by remote RpcException but not NPE of demoService.
return demoService.sayHello(name);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org