我正在尝试将我的 Spring Boot 应用程序配置为管理客户端,但在设置以下依赖项后无法构建它:
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.1.6</version>
</dependency>
在 pom.xml
中设置此依赖项后尝试构建应用程序时,出现以下错误:
Description:
尝试调用方法 org.springframework.boot.web.client.RestTemplateBuilder.setConnectTimeout(Ljava/time/Duration;)Lorg/springframework/boot/web/client/RestTemplateBuilder;但它不存在。它的类 org.springframework.boot.web.client.RestTemplateBuilder 可从以下位置获取:
jar:file:/Users/sherzad/.m2/repository/org/springframework/boot/spring-boot/2.0.6.RELEASE/spring-boot-2.0.6.RELEASE.jar!/org/springframework/boot/web/client/RestTemplateBuilder.class
它是从以下位置加载的:
file:/Users/sherzad/.m2/repository/org/springframework/boot/spring-boot/2.0.6.RELEASE/spring-boot-2.0.6.RELEASE.jar
行动:
更正应用程序的类路径,使其包含单个兼容版本的 org.springframework.boot.web.client.RestTemplateBuilder
我不知道为什么它有两个相同的 RestTemplateBuilder...
如何解决这个问题?
最佳答案
您可以尝试使用 spring-boot-admin-starter-client - 2.0.6 版本
希望它对你有用
关于java - Spring Boot 管理客户端无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59514230/