Spring 云 API 网关在 tomcat 上部署后无法正常工作
Spring Cloud API gateway not working after deploying it on tomcat
部署网关 war 后 tomcat 上的文件无法访问。
application.yml 文件设置
server:
port: 9000
servlet:
context-path: /gateway
spring:
cloud:
gateway:
routes:
- id: mysqlservice
uri: http://localhost:8080
predicates:
- Path= /gateway/mysql/**
filters:
- StripPrefix=1
- id: xyzservice
uri: http://localhost:8080
predicates:
- Path= /gateway/xyz/**
filters:
- StripPrefix=1
- id: lightservice
uri: http://localhost:8080
predicates:
- Path= /gateway/light/**
filters:
- StripPrefix=1
当我 运行 通过正常 spring 引导 JAR 文件
时,上面的配置工作正常
例如。 http://localhost:9000/gateway/mysql/mysqlapi/test
当它部署在 tomcat 服务器上时我无法访问它
例如。前任。 http://localhost:8080/gateway/mysql/mysqlapi/test
那么我如何从 tomcat 服务器访问它?
你不能这样 is not supported:
Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.
部署网关 war 后 tomcat 上的文件无法访问。
application.yml 文件设置
server:
port: 9000
servlet:
context-path: /gateway
spring:
cloud:
gateway:
routes:
- id: mysqlservice
uri: http://localhost:8080
predicates:
- Path= /gateway/mysql/**
filters:
- StripPrefix=1
- id: xyzservice
uri: http://localhost:8080
predicates:
- Path= /gateway/xyz/**
filters:
- StripPrefix=1
- id: lightservice
uri: http://localhost:8080
predicates:
- Path= /gateway/light/**
filters:
- StripPrefix=1
当我 运行 通过正常 spring 引导 JAR 文件
时,上面的配置工作正常例如。 http://localhost:9000/gateway/mysql/mysqlapi/test
当它部署在 tomcat 服务器上时我无法访问它
例如。前任。 http://localhost:8080/gateway/mysql/mysqlapi/test
那么我如何从 tomcat 服务器访问它?
你不能这样 is not supported:
Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.