You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/04/21 22:46:38 UTC

[incubator-servicecomb-website] branch master updated: Update producer develop docs (#63)

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git


The following commit(s) were added to refs/heads/master by this push:
     new fc525b6  Update producer develop docs (#63)
fc525b6 is described below

commit fc525b6cf2bec59ad2d8a52901ba19db6382fcba
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Sun Apr 22 06:46:36 2018 +0800

    Update producer develop docs (#63)
    
    * update producer develop docs
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
    
    * fix style
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
    
    * add main class step
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
    
    * fix pr comment
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
---
 _users/cn/develop-with-jax-rs.md          | 68 +++++++++++++++++++------
 _users/cn/develop-with-rpc.md             | 39 +++++++++++++++
 _users/cn/develop-with-springmvc.md       | 69 ++++++++++++++++++++------
 _users/cn/develop-with-transparent-rpc.md | 80 ++++++++++++++++++++++++------
 _users/develop-with-jax-rs.md             | 65 +++++++++++++++++++-----
 _users/develop-with-rpc.md                | 40 +++++++++++++++
 _users/develop-with-springmvc.md          | 66 ++++++++++++++++++++-----
 _users/develop-with-transparent-rpc.md    | 82 ++++++++++++++++++++++++-------
 8 files changed, 418 insertions(+), 91 deletions(-)

diff --git a/_users/cn/develop-with-jax-rs.md b/_users/cn/develop-with-jax-rs.md
index 648713c..9314031 100644
--- a/_users/cn/develop-with-jax-rs.md
+++ b/_users/cn/develop-with-jax-rs.md
@@ -16,21 +16,43 @@ redirect_from:
 ServiceComb支持开发者使用JAX-RS注解,使用JAX-RS模式开发服务。
 
 ## 开发示例
+* **步骤 1** 添加依赖。
 
-* **步骤 1** 定义服务接口。
+   在Maven的pom.xml中添加所需的依赖:
 
-   根据开发之前定义好的契约,编写Java业务接口,代码如下:
-
-   ```java
-   public interface Hello {
-     String sayHi(String name);
-     String sayHello(Person person);
-   }
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport根据microservice.yaml中endpoint发布需求选择,本例中两者都引入,也可以二选一-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-jaxrs</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
    ```
 
-   > **说明**:
-   该接口的位置需要与契约中x-java-interface所指定的路径一致。
-
 * **步骤 2** 实现服务。
 
    使用JAX-RS注解开发业务代码,Hello的服务实现如下:
@@ -40,22 +62,19 @@ ServiceComb支持开发者使用JAX-RS注解,使用JAX-RS模式开发服务。
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.MediaType;
-   import org.apache.servicecomb.samples.common.schema.Hello;
    import org.apache.servicecomb.samples.common.schema.models.Person;
 
    @Path("/jaxrshello")
    @Produces(MediaType.APPLICATION_JSON)
-   public class JaxrsHelloImpl implements Hello {
+   public class JaxrsHelloImpl {
      @Path("/sayhi")
      @POST
-     @Override
      public String sayHi(String name) {
       return "Hello " + name;
      }
 
      @Path("/sayhello")
      @POST
-     @Override
      public String sayHello(Person person) {
        return "Hello person " + person.getName();
      }
@@ -89,6 +108,25 @@ ServiceComb支持开发者使用JAX-RS注解,使用JAX-RS模式开发服务。
    </beans>
    ```
 
+* **步骤 4** 添加服务定义。
+
+   在resources目录中添加[microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/)。
+
+* **步骤 5** 添加Main启动类
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //初始化日志, 加载Bean(包括它们的参数), 以及注册Service, 更多信息可以参见文档 : http://servicecomb.incubator.apache.org/cn/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
+
 ## 涉及API
 
 JAX-RS开发模式当前支持如下注解,所有注解的使用方法参考[JAX-RS官方文档](https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/index.html)。
diff --git a/_users/cn/develop-with-rpc.md b/_users/cn/develop-with-rpc.md
index 7507cfd..ee7b89b 100644
--- a/_users/cn/develop-with-rpc.md
+++ b/_users/cn/develop-with-rpc.md
@@ -48,3 +48,42 @@ public class CodeFirstConsumerMain {
 ```
 
 在以上代码中,服务消费者已经取得了服务提供者的服务接口`Hello`,并在代码中声明一个`Hello`类型的成员。通过在`hello`上使用`@RPCReference`注解指明微服务名称和schemaId,ServiceComb框架可以在程序启动时从服务中心获取到对应的服务提供者实例信息,并且生成一个代理注入到hello中,用户可以像调用本地类一样调用远程服务。
+
+### 调用方式的补充说明
+上面示例代码中,为了能在main函数中直接使用hello变量,我们将它标记为`static`。作为CodeFirstConsumerMain这个Bean的本地变量,我们更推荐下面两种做法:
+#### 方式1:通过cse:rpc-reference定义
+在你的bean.xml中添加cse:rpc-reference的配置项:
+
+```xml
+<cse:rpc-reference id="hello" microservice-name="codefirst"
+    schema-id="codeFirstHello" interface="org.apache.servicecomb.samples.common.schema.Hello"></cse:rpc-reference>
+```
+
+然后就可以使用`BeanUtils.getBean`直接获取服务提供者的服务接口`Hello`:
+
+```java
+Hello hello = BeanUtils.getBean("hello");
+```
+
+#### 方式2:获取Bean,再获取接口
+先使用`BeanUtils.getBean`获取到CodeFirstConsumerMain这个Bean:
+
+```java
+//Spring Bean 实例默认名为类名的小写
+CodeFirstConsumerMain consumer = BeanUtils.getBean("codeFirstConsumerMain");
+```
+
+然后按Getter的方式获取hello:
+
+```java
+public Hello getHello() {
+    return hello;
+}
+```
+
+```java
+Hello hello = consumer.getHello()
+```
+
+> 说明:
+> `BeanUtils.getBean`有锁,因此有性能问题,无论是哪种方式,推荐一次调用(例如在构造函数中)获取缓存起来作为一个本地变量反复使用。
\ No newline at end of file
diff --git a/_users/cn/develop-with-springmvc.md b/_users/cn/develop-with-springmvc.md
index f5d3d5f..9a1c94f 100644
--- a/_users/cn/develop-with-springmvc.md
+++ b/_users/cn/develop-with-springmvc.md
@@ -15,20 +15,43 @@ redirect_from:
 ServiceComb支持SpringMVC注解,允许使用SpringMVC风格开发微服务。
 
 ## 开发示例
+* **步骤 1** 添加依赖。
 
-* **步骤 1** 定义服务接口。
+   在Maven的pom.xml中添加所需的依赖:
 
-   根据开发之前定义好的契约,编写Java业务接口,代码如下:
-
-   ```java
-   public interface Hello {
-     String sayHi(String name);
-     String sayHello(Person person);
-   }
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport根据microservice.yaml中endpoint发布需求选择,本例中两者都引入,也可以二选一-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-springmvc</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
    ```
 
-   该接口的位置需要与契约中x-java-interface所指定的路径一致。
-
 * **步骤 2** 实现服务。
 
    使用Spring MVC注解开发业务代码,Hello的服务实现如下:
@@ -39,18 +62,15 @@ ServiceComb支持SpringMVC注解,允许使用SpringMVC风格开发微服务。
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
-   import org.apache.servicecomb.samples.common.schema.Hello;
    import org.apache.servicecomb.samples.common.schema.models.Person;
    
    @RequestMapping(path = "/springmvchello", produces = MediaType.APPLICATION_JSON)
-   public class SpringmvcHelloImpl implements Hello {
-     @Override
+   public class SpringmvcHelloImpl {
      @RequestMapping(path = "/sayhi", method = RequestMethod.POST)
      public String sayHi(@RequestParam(name = "name") String name) {
       return "Hello " + name;
      }
 
-     @Override
      @RequestMapping(path = "/sayhello", method = RequestMethod.POST)
      public String sayHello(@RequestBody Person person) {
       return "Hello person " + person.getName();
@@ -66,7 +86,7 @@ ServiceComb支持SpringMVC注解,允许使用SpringMVC风格开发微服务。
    import org.apache.servicecomb.provider.rest.common.RestSchema;
    // other code omitted
    @RestSchema(schemaId = "springmvcHello")
-   public class SpringmvcHelloImpl implements Hello {
+   public class SpringmvcHelloImpl {
      // other code omitted
    }
    ```
@@ -86,6 +106,25 @@ ServiceComb支持SpringMVC注解,允许使用SpringMVC风格开发微服务。
    </beans>
    ```
 
+* **步骤 4** 添加服务定义。
+
+   在resources目录中添加[microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/)。
+   
+* **步骤 5** 添加Main启动类
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //初始化日志, 加载Bean(包括它们的参数), 以及注册Service, 更多信息可以参见文档 : http://servicecomb.incubator.apache.org/cn/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
+
 ## 涉及API
 
 Spring MVC开发模式当前支持org.springframework.web.bind.annotation包下的如下注解,所有注解的使用方法参考[Spring MVC官方文档](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html)。
diff --git a/_users/cn/develop-with-transparent-rpc.md b/_users/cn/develop-with-transparent-rpc.md
index c4461ea..ac0f2b8 100644
--- a/_users/cn/develop-with-transparent-rpc.md
+++ b/_users/cn/develop-with-transparent-rpc.md
@@ -15,10 +15,44 @@ redirect_from:
 透明RPC开发模式是一种基于接口和接口实现的开发模式,服务的开发者不需要使用Spring MVC和JAX-RS注解。
 
 ## 开发示例
+* **步骤 1** 添加依赖:
 
-透明RPC开发模式支持Spring xml配置和注解配置两种服务发布方式,通过Spring xml配置的方式如下:
+   在Maven的pom.xml中添加所需的依赖:
 
-* **步骤 1** 定义服务接口。
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport根据microservice.yaml中endpoint发布需求选择,本例中两者都引入,也可以二选一-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-pojo</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
+   ```
+
+* **步骤 2** 定义服务接口:
 
    根据开发之前定义好的契约,编写Java业务接口,代码如下:
 
@@ -29,10 +63,7 @@ redirect_from:
    }
    ```
 
-   > **说明**:
-   > 该接口的位置需要与契约中x-java-interface所指定的路径一致。
-
-* **步骤 2** 实现服务
+* **步骤 3** 实现服务:
 
    Hello的服务实现如下:
 
@@ -53,8 +84,11 @@ redirect_from:
    }
    ```
 
-* **步骤 3** 发布服务
+* **步骤 4** 发布服务
 
+   透明RPC开发模式支持Spring xml配置和注解配置两种服务发布方式:
+
+1. 使用Spring xml配置方式:
    在resources/META-INF/spring目录下创建pojoHello.bean.xml文件,在文件中声明schema,文件内容如下:
 
    ```xml
@@ -64,19 +98,14 @@ redirect_from:
           xmlns:cse=" http://www.huawei.com/schema/paas/cse/rpc "
           xmlns:context=" http://www.springframework.org/schema/context "
           xsi:schemaLocation=" http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.huawei.com/schema/paas/cse/rpc classpath:META-INF/spring/spring-paas-cse-rpc.xsd">
-   
+
        <cse:rpc-schema schema-id="pojoHello" implementation="org.apache.servicecomb.samples.pojo.provider.PojoHelloImpl"/>
    </beans>
    ```
 
-   > **说明**:
-   > 每一个服务接口都需要定义一个schema声明。
-
-## 通过注解配置的开发方式
+2. 使用注解配置方式:
 
-1. 定义服务接口,与使用Spring xml的方式相同。
-2. 实现服务,与使用Spring xml的方式相同。
-3. 发布服务。在接口Hello的实现类上使用@RpcSchema注解定义schema,代码如下:
+   在接口Hello的实现类上使用@RpcSchema注解定义schema,代码如下:
 
    ```java
    import org.apache.servicecomb.provider.pojo.RpcSchema;
@@ -102,4 +131,23 @@ redirect_from:
    ```
 
 > **说明**:
-> 与Spring MVC开发模式和JAX-RS开发模式不同的是,透明RPC开发模式使用的注解是`@RpcSchema`而非`@RestSchema`。
+与Spring MVC开发模式和JAX-RS开发模式不同的是,透明RPC开发模式使用的注解是`@RpcSchema`而非`@RestSchema`。
+
+* **步骤 5** 添加服务定义。
+
+   在resources目录中添加[microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/)。
+
+* **步骤 6** 添加Main启动类
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //初始化日志, 加载Bean(包括它们的参数), 以及注册Service, 更多信息可以参见文档 : http://servicecomb.incubator.apache.org/cn/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
\ No newline at end of file
diff --git a/_users/develop-with-jax-rs.md b/_users/develop-with-jax-rs.md
index 38d16cf..78d566e 100644
--- a/_users/develop-with-jax-rs.md
+++ b/_users/develop-with-jax-rs.md
@@ -17,18 +17,41 @@ ServiceComb supports developers in developing services in JAX-RS mode by using J
 
 ## Development Example
 
-* **Steps 1** Define a service API. Compile the Java API definition based on the API definition defined before development. The code is as follows:
+* **Step 1** Import dependencies into your maven project:
 
-   ```java
-   public interface Hello {
-     String sayHi(String name);
-     String sayHello(Person person);
-   }
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport can optional import through endpoint setting in microservice.yaml, we import both rest and highway as example-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-jaxrs</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
    ```
 
-   > **NOTE**:
-   > The location of the API must be the same as the path specified by x-java-interface in the API definition.
-
 * **Step 2** Implement the service. JAX-RS is used to describe the development of service code. The implementation of the Hello service is as follows:
 
    ```java
@@ -36,22 +59,19 @@ ServiceComb supports developers in developing services in JAX-RS mode by using J
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.MediaType;
-   import org.apache.servicecomb.samples.common.schema.Hello;
    import org.apache.servicecomb.samples.common.schema.models.Person;
 
    @Path("/jaxrshello")
    @Produces(MediaType.APPLICATION_JSON)
-   public class JaxrsHelloImpl implements Hello {
+   public class JaxrsHelloImpl {
      @Path("/sayhi")
      @POST
-     @Override
      public String sayHi(String name) {
       return "Hello " + name;
      }
 
      @Path("/sayhello")
      @POST
-     @Override
      public String sayHello(Person person) {
        return "Hello person " + person.getName();
      }
@@ -83,6 +103,25 @@ ServiceComb supports developers in developing services in JAX-RS mode by using J
    </beans>
    ```
 
+* **Step 4** Add service definition file:
+
+   Add [microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/) file into resources folder of your project.
+
+* **Step 5** Add Main class:
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //initializing log, loading bean(including its parameters), and registering service, more detail can be found here :  http://servicecomb.incubator.apache.org/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
+
 ## Involved APIs
 
 Currently, the JAX-RS development mode supports the following annotation. For details about how to use JAX-RS, see [JAX-RS official documentation](https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/index.html)。
diff --git a/_users/develop-with-rpc.md b/_users/develop-with-rpc.md
index 032e31d..1c84295 100644
--- a/_users/develop-with-rpc.md
+++ b/_users/develop-with-rpc.md
@@ -48,3 +48,43 @@ public class CodeFirstConsumerMain {
 ```
 
 In the preceding code, the microservice consumers have obtained the microservice API Hello of the microservice provider and declared a member of the Hello type. The annotation `@RPCReference` on `Hello` specifies the microservice name and schemaId, The ServiceComb framework can obtain information about isntances from a certain provider during program startup and generate an agent to insert to Hello. This allows you to call a remote service in the same way as you call a local class.
+
+### Additional explanation for consumer invocation
+In above example, in order to direct use `hello` in main function, we mark it as `static`. As a local field of `CodeFirstConsumerMain`, we recommend get it use these two way :
+
+#### First way: define cse:rpc-reference
+In your bean.xml, add `cse:rpc-reference` configuration:
+
+```xml
+<cse:rpc-reference id="hello" microservice-name="codefirst"
+    schema-id="codeFirstHello" interface="org.apache.servicecomb.samples.common.schema.Hello"></cse:rpc-reference>
+```
+
+Then use `BeanUtils.getBean` to get `Hello` provider:
+
+```java
+Hello hello = BeanUtils.getBean("hello");
+```
+
+#### Second way: get Bean, then use field
+First use `BeanUtils.getBean` to get Bean of `CodeFirstConsumerMain`:
+
+```java
+//Default instance name of Spring Bean is same as class name with first char low-cased
+CodeFirstConsumerMain consumer = BeanUtils.getBean("codeFirstConsumerMain");
+```
+
+Then get `hello` via Getter:
+
+```java
+public Hello getHello() {
+    return hello;
+}
+```
+
+```java
+Hello hello = consumer.getHello()
+```
+
+> NOTE:
+> `BeanUtils.getBean` has inner lock so performacen is low , we recommend use once and cache return as local field for future use(such as in constructor).
\ No newline at end of file
diff --git a/_users/develop-with-springmvc.md b/_users/develop-with-springmvc.md
index 92cc901..4981c7a 100644
--- a/_users/develop-with-springmvc.md
+++ b/_users/develop-with-springmvc.md
@@ -16,17 +16,41 @@ ServiceComb supports Spring MVC remark and allows you to develop microservices i
 
 ## Development Example
 
-* **Step 1** Define a service API., Compile the Java API definition based on the API definition defined before development. The code is as follow:
+* **Step 1** Import dependencies into your maven project:
 
-   ```java
-   public interface Hello {
-     String sayHi(String name);
-     String sayHello(Person person);
-   }
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport can optional import through endpoint setting in microservice.yaml, we import both rest and highway as example-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-springmvc</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
    ```
 
-   The location of the API must be the same as the path specified by x-java-interface in the API definition.
-
 * **Step 2** Implement the services. Spring MVC is used to describe the development of service code. The implementation of the Hello service is as follow:
 
    ```java
@@ -35,18 +59,15 @@ ServiceComb supports Spring MVC remark and allows you to develop microservices i
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
-   import org.apache.servicecomb.samples.common.schema.Hello;
    import org.apache.servicecomb.samples.common.schema.models.Person;
 
    @RequestMapping(path = "/springmvchello", produces = MediaType.APPLICATION_JSON)
-   public class SpringmvcHelloImpl implements Hello {
-     @Override
+   public class SpringmvcHelloImpl {
      @RequestMapping(path = "/sayhi", method = RequestMethod.POST)
      public String sayHi(@RequestParam(name = "name") String name) {
       return "Hello " + name;
      }
 
-     @Override
      @RequestMapping(path = "/sayhello", method = RequestMethod.POST)
      public String sayHello(@RequestBody Person person) {
       return "Hello person " + person.getName();
@@ -60,7 +81,7 @@ ServiceComb supports Spring MVC remark and allows you to develop microservices i
    import org.apache.servicecomb.provider.rest.common.RestSchema;
    // other code omitted
    @RestSchema(schemaId = "springmvcHello")
-   public class SpringmvcHelloImpl implements Hello {
+   public class SpringmvcHelloImpl {
      // other code omitted
    }
    ```
@@ -80,6 +101,25 @@ ServiceComb supports Spring MVC remark and allows you to develop microservices i
    </beans>
    ```
 
+* **Step 4** Add service definition file:
+
+   Add [microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/) file into resources folder of your project.
+
+* **Step 5** Add Main class:
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //initializing log, loading bean(including its parameters), and registering service, more detail can be found here : http://servicecomb.incubator.apache.org/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
+
 ## Involved APIs
 
 Currently, the Spring MVC development mode supports the following annotations in the org.springframework.web.bind.annotation package. For details about how to use the annotations, see [Spring MVC official documentation](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html)。
diff --git a/_users/develop-with-transparent-rpc.md b/_users/develop-with-transparent-rpc.md
index 8519b01..a573aeb 100644
--- a/_users/develop-with-transparent-rpc.md
+++ b/_users/develop-with-transparent-rpc.md
@@ -16,9 +16,42 @@ The transparent remote procedure call(RPC) development mode is a development mod
 
 ## Development Example
 
-The transparent RPC development mode supports two service release mode: Spring XML configuration and annotation configuration. The Spring XML configuration mode is as follows:
+* **Step 1** Import dependencies into your maven project:
 
-* **Step 1** Define a service API. Compile the Java API definition based on the API definition defined before development. The code is as follows:
+   ```xml
+    <dependencyManagement>
+     <dependencies>
+       <dependency>
+         <groupId>org.apache.servicecomb</groupId>
+         <artifactId>java-chassis-dependencies</artifactId>
+         <version>1.0.0-m1</version>
+         <type>pom</type>
+         <scope>import</scope>
+       </dependency>
+     </dependencies>
+    </dependencyManagement>
+    <dependencies>
+      <!--transport can optional import through endpoint setting in microservice.yaml, we import both rest and highway as example-->
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-rest-vertx</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>transport-highway</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.servicecomb</groupId>
+        <artifactId>provider-pojo</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+      </dependency>
+    </dependencies>
+   ```
+
+* **Step 2** Define a service API. Compile the Java API definition based on the API definition defined before development. The code is as follows:
 
    ```java
    public interface Hello {
@@ -27,10 +60,7 @@ The transparent RPC development mode supports two service release mode: Spring X
    }
    ```
 
-   > **NOTE**:
-   > The location of the API must be the same as the path specified by x-java-interface in the API definition.
-
-* **Step 2** implement the service. The implementation of the Hello service is as follows:
+* **Step 3** implement the service. The implementation of the Hello service is as follows:
 
    ```java
    import org.apache.servicecomb.samples.common.schema.Hello;
@@ -49,7 +79,10 @@ The transparent RPC development mode supports two service release mode: Spring X
    }
    ```
 
-* **Step 3** Release the service. Create the pojoHello.bean.xml file in the resources/META-INF/spring directory and declare the schema in the file. The content of the file is as follows:
+* **Step 4** Release the service. 
+   The transparent RPC development mode supports two service release mode: Spring XML configuration and Annotation configuration:
+1. Spring XML configuration Mode:
+   Create the pojoHello.bean.xml file in the resources/META-INF/spring directory and declare the schema in the file. The content of the file is as follows:
 
    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
@@ -63,16 +96,8 @@ The transparent RPC development mode supports two service release mode: Spring X
    </beans>
    ```
 
-   > **NOTE**:
-   > A schema statement must be defined for each service API.
-
-## The Develop Method by Configure Remarks
-
-1. Define a service API, which is the same as the Spring XML mode.
-
-2. Implement the service in the same way as using Spring XML.
-
-3. Release the service. @RpcSchema is used to define schema during the API Hello implementation. The code is as followss:
+2. Annotation configuration Mode:
+   @RpcSchema is used to define schema during the API Hello implementation. The code is as follows:
 
    ```java
    import org.apache.servicecomb.provider.pojo.RpcSchema;
@@ -97,5 +122,24 @@ The transparent RPC development mode supports two service release mode: Spring X
    </beans>
    ```
 
-> **NOTE**:
-> Different from the Spring MVC and JAX-RS development modes, the transparent RPC development mode used `@RpcSchema` instead of `@RestSchema`.
+> **NOTE**:
+Different from the Spring MVC and JAX-RS development modes, the transparent RPC development mode used `@RpcSchema` instead of `@RestSchema`.
+
+* **Step 5** Add service definition file:
+
+   Add [microservice.yaml](http://servicecomb.incubator.apache.org/cn/users/service-definition/) file into resources folder of your project.
+   
+* **Step 6** Add Main class:
+
+   ```java
+   import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+   import org.apache.servicecomb.foundation.common.utils.Log4jUtils;
+
+   public class Application {
+     public static void main(String[] args) throws Exception {
+        //initializing log, loading bean(including its parameters), and registering service, more detail can be found here : http://servicecomb.incubator.apache.org/users/application-boot-process/
+        Log4jUtils.init();
+        BeanUtils.init();
+     }
+   }
+   ```
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.