mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
添加文档
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
* [首页](/?t=1553513181526)
|
||||
* [首页](/?t=1553564490530)
|
||||
* 开发文档
|
||||
* [快速体验](files/10010_快速体验.md?t=1553513181526)
|
||||
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1553513181547)
|
||||
* [新增接口](files/10020_新增接口.md?t=1553513181547)
|
||||
* [业务参数校验](files/10030_业务参数校验.md?t=1553513181547)
|
||||
* [错误处理](files/10040_错误处理.md?t=1553513181547)
|
||||
* [接口交互详解](files/10050_接口交互详解.md?t=1553513181547)
|
||||
* [快速体验](files/10010_快速体验.md?t=1553564490530)
|
||||
* [项目接入到SOP](files/10011_项目接入到SOP.md?t=1553564490570)
|
||||
* [新增接口](files/10020_新增接口.md?t=1553564490570)
|
||||
* [业务参数校验](files/10030_业务参数校验.md?t=1553564490570)
|
||||
* [错误处理](files/10040_错误处理.md?t=1553564490571)
|
||||
* [接口交互详解](files/10050_接口交互详解.md?t=1553564490571)
|
||||
* [使用SpringCloudGateway](files/10060_使用SpringCloudGateway.md?t=1553564490571)
|
||||
* 原理分析
|
||||
* [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1553513181547)
|
||||
* [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1553513181547)
|
||||
* [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1553564490571)
|
||||
* [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1553564490571)
|
||||
|
75
doc/docs/files/10060_使用SpringCloudGateway.md
Normal file
75
doc/docs/files/10060_使用SpringCloudGateway.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# 使用SpringCloudGateway
|
||||
|
||||
SOP默认网关是使用Spring Cloud Zuul,您也可以切换成Spring Cloud Gateway。
|
||||
|
||||
**注:**:SOP对Spring Cloud Gateway的支持目前处于beta阶段,推荐使用zuul。
|
||||
|
||||
步骤如下:
|
||||
|
||||
- 打开sop-gateway/pom.xml,注释spring cloud zuul依赖,打开Spring Cloud Gateway依赖
|
||||
|
||||
```xml
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- ↑↑↑ 使用spring cloud zuul ↑↑↑ -->
|
||||
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud gateway,处于beta阶段,推荐使用zuul ↓↓↓ -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ↑↑↑ 使用spring cloud gateway ↑↑↑ -->
|
||||
```
|
||||
|
||||
- 打开启动类`SopGatewayApplication.java`, 注释zuul相关注解
|
||||
|
||||
```java
|
||||
package com.gitee.sop.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
|
||||
// 开启网关功能
|
||||
//@EnableZuulProxy
|
||||
@SpringBootApplication
|
||||
public class SopGatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SopGatewayApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
- 禁用ZuulConfig类,注释掉@Configuration注解即可
|
||||
|
||||
```java
|
||||
//@Configuration
|
||||
public class ZuulConfig extends AlipayZuulConfiguration {
|
||||
```
|
||||
|
||||
- 启用GatewayConfig类,打开@Configuration注释
|
||||
|
||||
```java
|
||||
@Configuration
|
||||
public class GatewayConfig extends AlipayGatewayConfiguration
|
||||
```
|
||||
|
||||
修改完毕,重启sop-gateway
|
||||
|
||||
运行SpringCloudGatewayClientPostTest测试用例。
|
Reference in New Issue
Block a user