一 代码位置
https://github.com/cakin24/spring-cloud-code/tree/master/ch17-3/ch17-3-3-gateway
https://github.com/cakin24/spring-cloud-code/tree/master/ch17-3/ch17-3-service
二 关键代码
package cn.springcloud.book.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class SCGatewayApplication {
@Bean
public RouteLocator testRouteLocator(RouteLocatorBuilder builder) {
// 关键代码下面几行
return