springcloud和springboot一般都是需要版本号匹配的,如果这一块不注意的话,很多时候在导入某些pom依赖时,会出现错误。我这里碰到的是spring-cloud-start-gateway
的问题
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.gateway.config.GatewayAutoConfiguration$NettyConfiguration.buildConnectionProvider(GatewayAutoConfiguration.java:798)
The following method did not exist:
reactor.netty.resources.ConnectionProvider$Builder.evictInBackground(Ljava/time/Duration;)Lreactor/netty/resources/ConnectionProvider$ConnectionPoolSpec;
The method's class, reactor.netty.resources.ConnectionProvider$Builder, is available from the following locations:
jar:file:/D:/maven/repository/io/projectreactor/netty/reactor-netty/0.9.12.RELEASE/reactor-netty-0.9.12.RELEASE.jar!/reactor/netty/resources/ConnectionProvider$Builder.class
The class hierarchy was loaded from the following locations:
reactor.netty.resources.ConnectionProvider.Builder: file:/D:/maven/repository/io/projectreactor/netty/reactor-netty/0.9.12.RELEASE/reactor-netty-0.9.12.RELEASE.jar
reactor.netty.resources.ConnectionProvider.ConnectionPoolSpec: file:/D:/maven/repository/io/projectreactor/netty/reactor-netty/0.9.12.RELEASE/reactor-netty-0.9.12.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider$Builder
我网上看了一下,大多数是说修改netty的版本号。
这个方法比较宽,只能看个大概,而且也比较常见。但是有可能会还是有问题
官方提供的版本号匹配
这里存在一个问题,范围太宽了。例如spring-cloud
Hoxton.SR12
版本对应 spring boot
2.2.0到2.4.0
。但是我在实际使用中出错了。我这里使用的是 spring-cloud Hoxton SR12
和spring-boot 2.3.4
Hoxton.SR10
spring-cloud Hoxton.SR12
和spring-boot 2.3.12.Release
后,gateway项目能正常启动了。而不是常见答案中的修改 netty版本号