我正在尝试配置Spring Boot Admin Client,但是我启动了无法向Server注册的客户端应用程序。启动应用程序时,出现以下异常。
java.lang.IllegalStateException:重复的密钥端点(id = threaddump,url = http://localhost:9082/client-web/management/actuator/dump)
我正在使用客户端的依赖版本,该版本与我用于Spring Boot Admin Server的版本相同
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.0.1</version>
</dependency>
是什么原因引起的?
答案 0 :(得分:1)
这是“ Spring boot admin 1.x”中的已知错误。但是已在更高版本(2.0.2)中修复。 Endpoints 列表是从AdminServerProperties类获取的,默认列表为
{
"health", "env", "metrics", "httptrace:trace",
"httptrace","threaddump:dump","threaddump", "jolokia", "info",
"logfile", "refresh", "flyway",
"liquibase", "heapdump", "loggers","auditevents"
};
重复键的问题似乎是由于同时存在“ httptrace:trace”和“ httptrace”引起的(对于threaddump同样如此)
通过添加行在config中覆盖它似乎可以解决问题。
spring.boot.admin.probed-endpoints: [ "health", "env", "metrics", "httptrace:trace", "threaddump:dump", "jolokia", "info", "logfile", "refresh", "flyway", "liquibase", "heapdump", "loggers", "auditevents" ]
请参阅以下内容:https://github.com/codecentric/spring-boot-admin/issues/828
或者,您可以如下更新pom.xml
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.0.2 or above</version>
</dependency>