This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new d880b48 [Doc]: user guide support new feature docs[http,
spring-cloud] (#431)
d880b48 is described below
commit d880b48d2d737fef42e165c2f809746b0a8df6c9
Author: likeguo <[email protected]>
AuthorDate: Fri Jan 7 10:56:20 2022 +0800
[Doc]: user guide support new feature docs[http, spring-cloud] (#431)
* change user guide docs
* change user guide docs
---
docs/user-guide/http-proxy.md | 54 +++++++++++++++++++++++
docs/user-guide/spring-cloud-proxy.md | 83 +++++++++++++++++++++++++++++++++++
2 files changed, 137 insertions(+)
diff --git a/docs/user-guide/http-proxy.md b/docs/user-guide/http-proxy.md
index 941df42..1916f4a 100644
--- a/docs/user-guide/http-proxy.md
+++ b/docs/user-guide/http-proxy.md
@@ -164,6 +164,60 @@ The following indicates that `/order/save` is proxied by
the gateway, while `/or
}
```
+example (3):This is a simplified way to use it, just need a simple annotation
to register to the gateway using metadata.
+Special note: currently only supports @RequestMapping, @GetMapping,
@PostMapping, @DeleteMapping, @PutMapping annotations, and only valid for the
first path in @XXXMapping
+
+```java
+ @RestController
+ @RequestMapping("new/feature")
+ public class NewFeatureController {
+
+ /**
+ * no support gateway access api.
+ *
+ * @return result
+ */
+ @RequestMapping("/gateway/not")
+ public EntityResult noSupportGateway() {
+ return new EntityResult(200, "no support gateway access");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used request mapping path.
+ *
+ * @return result
+ */
+ @RequestMapping("/requst/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult requestMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
request mapping path");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used post mapping path.
+ *
+ * @return result
+ */
+ @PostMapping("/post/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult postMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
post mapping path");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used post mapping path.
+ *
+ * @return result
+ */
+ @GetMapping("/get/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult getMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
get mapping path");
+ }
+ }
+
+```
+
* Start your project, your service interface is connected to the gateway, go
to the `shenyu-admin` management system plugin list `->` HTTP process `->`
Divide, see automatically created selectors and rules.
diff --git a/docs/user-guide/spring-cloud-proxy.md
b/docs/user-guide/spring-cloud-proxy.md
index bb7506b..a79d54f 100644
--- a/docs/user-guide/spring-cloud-proxy.md
+++ b/docs/user-guide/spring-cloud-proxy.md
@@ -85,6 +85,35 @@ add these config values in gateway's yaml file:
server-addr: 127.0.0.1:8848 # your nacos address
```
+Special note: Please ensure that the spring Cloud registry service discovery
configuration is enabled
+
+* Configuration method
+
+```yml
+spring:
+ cloud:
+ discovery:
+ enabled: true
+```
+
+* code method
+
+```java
+@SpringBootApplication
+@EnableDiscoveryClient
+public class ShenyuBootstrapApplication {
+
+ /**
+ * Main Entrance.
+ *
+ * @param args startup arguments
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(ShenyuBootstrapApplication.class, args);
+ }
+}
+```
+
* restart your gateway service.
## SpringCloud service access gateway
@@ -191,6 +220,60 @@ shenyu:
}
```
+example (4):This is a simplified way to use it, just need a simple annotation
to register to the gateway using metadata.
+Special note: currently only supports @RequestMapping, @GetMapping,
@PostMapping, @DeleteMapping, @PutMapping annotations, and only valid for the
first path in @XXXMapping
+
+```java
+ @RestController
+ @RequestMapping("new/feature")
+ public class NewFeatureController {
+
+ /**
+ * no support gateway access api.
+ *
+ * @return result
+ */
+ @RequestMapping("/gateway/not")
+ public EntityResult noSupportGateway() {
+ return new EntityResult(200, "no support gateway access");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used request mapping path.
+ *
+ * @return result
+ */
+ @RequestMapping("/requst/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult requestMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
request mapping path");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used post mapping path.
+ *
+ * @return result
+ */
+ @PostMapping("/post/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult postMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
post mapping path");
+ }
+
+ /**
+ * Do not use shenyu annotation path. used post mapping path.
+ *
+ * @return result
+ */
+ @GetMapping("/get/mapping/path")
+ @ShenyuSpringCloudClient
+ public EntityResult getMappingUrl() {
+ return new EntityResult(200, "Do not use shenyu annotation path. used
get mapping path");
+ }
+ }
+
+```
+
* After successfully registering your service, go to the backend management
system PluginList -> rpc proxy -> springCloud ', you will see the automatic
registration of selectors and rules information.