ralf0131 closed pull request #12: Fix an error in "local mock" chapter. 
URL: https://github.com/apache/incubator-dubbo-docs/pull/12
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-user-book-en/demos/local-mock.md 
b/dubbo-user-book-en/demos/local-mock.md
index 15b2cce..28ab66b 100644
--- a/dubbo-user-book-en/demos/local-mock.md
+++ b/dubbo-user-book-en/demos/local-mock.md
@@ -5,13 +5,13 @@ Local mock [^1] is usually used for service downgrade, such 
as a verification se
 Configured in the spring configuration file as follows:
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="true" />
+<dubbo:reference interface="com.foo.BarService" mock="true" />
 ```
 
 or
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="com.foo.BarServiceMock" />
+<dubbo:reference interface="com.foo.BarService" mock="com.foo.BarServiceMock" 
/>
 ```
 
 Mock implementation in the project [^2]:
@@ -40,7 +40,7 @@ try {
 Consider changing to Mock implementation and return null in Mock 
implementation. If you just want to simply ignore the exception, `2.0.11` 
version or later version is available:
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="return null" />
+<dubbo:reference interface="com.foo.BarService" mock="return null" />
 ```
 
 [^1]: Mock is a subset of the Stub. If you use Stub, you may need to rely on 
the RpcException class. If you use Mock, you do not need to rely on 
RpcException, when throwing RpcException, it will callback Mock implementation 
class.
diff --git a/dubbo-user-book/demos/local-mock.md 
b/dubbo-user-book/demos/local-mock.md
index 128b40c..1518b7a 100644
--- a/dubbo-user-book/demos/local-mock.md
+++ b/dubbo-user-book/demos/local-mock.md
@@ -5,13 +5,13 @@
 在 spring 配置文件中按以下方式配置:
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="true" />
+<dubbo:reference interface="com.foo.BarService" mock="true" />
 ```
 
 或
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="com.foo.BarServiceMock" />
+<dubbo:reference interface="com.foo.BarService" mock="com.foo.BarServiceMock" 
/>
 ```
 
 在工程中提供 Mock 实现 [^2]:
@@ -40,7 +40,7 @@ try {
 请考虑改为 Mock 实现,并在 Mock 实现中 return null。如果只是想简单的忽略异常,在 `2.0.11` 以上版本可用:
 
 ```xml
-<dubbo:service interface="com.foo.BarService" mock="return null" />
+<dubbo:reference interface="com.foo.BarService" mock="return null" />
 ```
 
 [^1]: Mock 是 Stub 的一个子集,便于服务提供方在客户端执行容错逻辑,因经常需要在出现 RpcException 
(比如网络失败,超时等)时进行容错,而在出现业务异常(比如登录用户名密码错误)时不需要容错,如果用 Stub,可能就需要捕获并依赖 RpcException 
类,而用 Mock 就可以不依赖 RpcException,因为它的约定就是只有出现 RpcException 时才执行。


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to