Spring cloud gateway的POM配置和yml的配置

因为web的包和gateway的包冲突,我路由转发的时候没有效果。所以要把web的tomcat移除。
POM配置

<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.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
         <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

YML配置

spring:
  application:
    name: gateway-web
  cloud:
    gateway:
      globalcors:
        cors-configurations:
          '[/**]':  #匹配所有请求
              allowedOrigins: "*" #跨域处理 允许所有的域
              allowedMethods: #支持的方法
                - GET
                - POST
                - PUT
                - DELETE
      routes:
        - id:  goods
          uri: http://localhost:6001
          predicates:
            - Path=/**

你可能感兴趣的:(Spring cloud gateway的POM配置和yml的配置)