项目使用spring-boot-admin做应用健康监控,初始使用版本2.2.3
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.2.3</version>
</dependency>
导致依赖冲突
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
de.codecentric.boot.admin.server.services.AbstractEventHandler.start(AbstractEventHandler.java:57)
The following method did not exist:
reactor.core.publisher.Flux.retryWhen(Ljava/util/function/Function;)Lreactor/core/publisher/Flux;
The calling method's class, de.codecentric.boot.admin.server.services.AbstractEventHandler, was loaded from the following location:
jar:file:/D:/program/maven/rep/de/codecentric/spring-boot-admin-server/2.2.3/spring-boot-admin-server-2.2.3.jar!/de/codecentric/boot/admin/server/services/AbstractEventHandler.class
The called method's class, reactor.core.publisher.Flux, is available from the following locations:
jar:file:/D:/program/maven/rep/io/projectreactor/reactor-core/3.4.22/reactor-core-3.4.22.jar!/reactor/core/publisher/Flux.class
The called method's class hierarchy was loaded from the following locations:
reactor.core.publisher.Flux: file:/D:/program/maven/rep/io/projectreactor/reactor-core/3.4.22/reactor-core-3.4.22.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes de.codecentric.boot.admin.server.services.AbstractEventHandler and reactor.core.publisher.Flux
Process finished with exit code 1
这里的retryWhen方法不存在
public void start() {
this.scheduler = this.createScheduler();
this.subscription = Flux.from(this.publisher).subscribeOn(this.scheduler).log(this.log.getName(), Level.FINEST)
.doOnSubscribe((s) -> this.log.debug("Subscribed to {} events", this.eventType)).ofType(this.eventType)
.cast(this.eventType).transform(this::handle).retryWhen(Retry.any().retryMax(Long.MAX_VALUE)
.doOnRetry((ctx) -> this.log.warn("Unexpected error", ctx.exception())))
.subscribe();
}
解决方法下载maven helper插件
检查依赖是否冲突
发现没有依赖冲突,最后发现是版本太低将版本升高至2.7.5
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.7.5</version>
</dependency>
问题解决