服务最开始引入的主要依赖版本如下:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version> <relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
但是当服务启动时,一直抛出如下异常:
Parameter 0 of method websocketRoutingFilter in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.web.reactive.socket.client.WebSocketClient' that could not be found.The following candidates were found but could not be injected: - Bean method 'reactorNettyWebSocketClient' in 'GatewayAutoConfiguration.NettyConfiguration' not loaded because @ConditionalOnClass did not find required class 'reactor.ipc.netty.http.client.HttpClient'
花费大量时间排查原因,最终找到问题是因为springcloud的Finchley版本与springboot 2.1.0不兼容。要么降级到引导2.0.6,要么使用Greenwich.M3,最终采用Greenwich.M3,
启动正常!!!
来源:https://github.com/spring-cloud/spring-cloud-gateway/issues/319
网友评论