搭建spring gateway一些坑
项目搭建的坑:
问题一:启动项目后提示
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.
解决办法:
如果要使用Spring Gateway 就不要引入Springboot的依赖,二者有冲突
问题二:启动报错
Error creating bean with name 'org.springframework.cloud.gateway.discovery.GatewayDiscoveryClientAutoConfiguration$ReactiveDiscoveryClientRouteDefinitionLocatorConfiguration
或者
org.springframework.cloud.gateway.discovery.GatewayDiscoveryClientAutoConfiguration$ReactiveDiscoveryClientRouteDefinitionLocatorConfiguration
报错的问题里有关于ReactiveDiscoveryClient。
解决办法:
更换spring cloud 依赖,在Spring Cloud Hoxton中加入了ReactiveDiscoveryClient,所以更换Spring Cloud版本。
附上能够成功使用的依赖版本:
<dep