今天用从zuul网关换到spring cloud gateway网关,配置好项目后访问报错如下:

java.lang.ClassCastException: org.springframework.core.io.buffer.DefaultDataBufferFactory cannot be cast to org.springframework.core.io.buffer.NettyDataBufferFactory

spring cloud gateway 报错 cannot be cast to org.springframework.core.io.buffer.NettyDataBufferFactory_spring

最终发现是包冲突下面这个包

compile 'org.springframework.boot:spring-boot-starter-undertow'

PS:检查自己的依赖里是否有spring-boot-starter-web,这个会冲突。

gataway路由功能仅此需要,eureka另说。

implementation 'org.springframework.cloud:spring-cloud-starter-gateway'