From 2d251d61bd2e7604ff66cc9bc538a612cc5efe37 Mon Sep 17 00:00:00 2001 From: andrewshan Date: Fri, 10 Dec 2021 15:33:23 +0800 Subject: [PATCH] optimize quickstart document --- .../polaris-quickstart-example/README-zh.md | 11 +++-- .../polaris-quickstart-example/README.md | 45 ++++++++++++++++--- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/spring-cloud-tencent-examples/polaris-quickstart-example/README-zh.md b/spring-cloud-tencent-examples/polaris-quickstart-example/README-zh.md index 25480266..73f0454c 100644 --- a/spring-cloud-tencent-examples/polaris-quickstart-example/README-zh.md +++ b/spring-cloud-tencent-examples/polaris-quickstart-example/README-zh.md @@ -1,5 +1,9 @@ # Spring Cloud Polaris Quickstart example +[English](./README.md) | 简体中文 + +--- + ## 样例简介 本样例将介绍如何使应用快速接入Spring Cloud Tencent。 @@ -8,7 +12,8 @@ ### 修改配置 -在 polaris-quickstart-example/quickstart-provider 以及 polaris-quickstart-example/quickstart-consumer 两个项目中,修改bootstrap.yml,修改后配置如下所示。其中,${ip}和${port}为Polaris后端服务的IP地址与端口号。 +在 ```polaris-quickstart-example/quickstart-provider``` 以及 ```polaris-quickstart-example/quickstart-consumer``` 两个项目中,修改```bootstrap.yml```,修改后配置如下所示。 +其中,```${ip}```和${port}为Polaris后端服务的IP地址与端口号。 ```yaml spring: @@ -25,7 +30,7 @@ spring: - IDEA启动 - 找到 polaris-quickstart-example/quickstart-provider 项目的主类 EchoServerApplication,执行 main 方法启动样例。 + 找到 ```polaris-quickstart-example/quickstart-provider``` 项目的主类 ```EchoServerApplication```,执行 main 方法启动样例。 - Maven打包启动 @@ -47,7 +52,7 @@ java -jar ${app.jar} - IDEA启动 - 找到 polaris-quickstart-example/quickstart-consumer 项目的主类 EchoClientApplication,执行 main 方法启动样例。 + 找到 ```polaris-quickstart-example/quickstart-consumer``` 项目的主类 ```EchoClientApplication```,执行 main 方法启动样例。 - Maven打包启动 diff --git a/spring-cloud-tencent-examples/polaris-quickstart-example/README.md b/spring-cloud-tencent-examples/polaris-quickstart-example/README.md index 98d36bcf..93611059 100644 --- a/spring-cloud-tencent-examples/polaris-quickstart-example/README.md +++ b/spring-cloud-tencent-examples/polaris-quickstart-example/README.md @@ -1,6 +1,10 @@ # Spring Cloud Polaris Quickstart example -## Example Introduction +English | [简体中文](./README-zh.md) + +--- + +## Introduction This example shows how to make application integrated with spring-cloud-tencent rapidly. @@ -8,7 +12,7 @@ This example shows how to make application integrated with spring-cloud-tencent ### Configuration -Modify bootstrap.yml, ${ip} and ${port} is the address of polaris server. +Modify ```bootstrap.yml```, ${ip} and ${port} is the address of polaris server. ```yaml spring: @@ -19,17 +23,39 @@ spring: address: grpc://${ip}:${port} ``` -### Launching Example +### Start Application + +#### Start Provider + +- Start in IDEA + +Find main class ```EchoServerApplication``` in project ```polaris-quickstart-example/quickstart-provider```, and execute the main method. + +- Start by fatjar + +Run build command in ```polaris-quickstart-example/quickstart-provider```: + +```sh +mvn clean package +``` + +find the generated fatjar, run: + +``` +java -jar ${app.jar} +``` + +${app.jar} replace to the built jar name. -#### Launching Application +#### Start Consumer - Start in IDEA -Find main class EchoServiceApplication in project polaris-quickstart-example, and execute the main method. +Find main class ```EchoClientApplication``` in project ```polaris-quickstart-example/quickstart-consumer```, and execute the main method. - Start by fatjar -Run build command in ```spring-cloud-tencent-examples/polaris-quickstart-example```: +Run build command in ```polaris-quickstart-example/quickstart-consumer```: ```sh mvn clean package @@ -47,8 +73,13 @@ ${app.jar} replace to the built jar name. #### Invoke by http call +Consumer and Provider application use random generated port, so you need to record the consumer port from start log. + ``` + 11:26:53 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 58838 (http) with context path '' + ``` +Invoke http call,replace `${app.port}` to the consumer port. ```shell curl -L -X GET 'http://localhost:47080/quickstart/feign?msg=hello_world'' ``` -expect:hello_world \ No newline at end of file +expect:`echo: hello_world` \ No newline at end of file