# 使用SpringCloudGateway
SOP默认网关是使用Spring Cloud Zuul,您也可以切换成Spring Cloud Gateway,完整代码见`spring-cloud-gateway`分支。
步骤如下:
- 打开sop-gateway/pom.xml,注释spring cloud zuul依赖,打开Spring Cloud Gateway依赖
```xml
org.springframework.cloud
spring-cloud-starter-gateway
org.springframework.boot
spring-boot-starter-webflux
org.springframework.boot
spring-boot-starter-actuator
```
- 打开启动类`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