Spring-Boot-Admin 应用程序未启动,因为创建名为 adminHandlerMapping 的 bean 时出错

Spring-Boot-Admin application not starting because of error creating bean with name adminHandlerMapping

我正在关注此 blog 以试用 Spring-Boot-Admin 应用程序。当我 运行 应用程序失败并出现以下错误时:

Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'adminHandlerMapping' defined in class path resource [de/codecentric/boot/admin/server/config/AdminServerWebConfiguration$ServletRestApiConfirguation.class]:
    Invocation of init method failed; nested exception is java.lang.WhosebugError

我往下看,发现下面几行:

at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_231]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.1.RELEASE.jar:2.2.1.RELEASE]
Caused by: java.lang.WhosebugError: null
    at de.codecentric.boot.admin.server.web.servlet.AdminControllerHandlerMapping.withPrefix(AdminControllerHandlerMapping.java:48) ~[spring-boot-admin-server-2.1.0.jar:2.1.0]
    at de.codecentric.boot.admin.server.web.servlet.AdminControllerHandlerMapping.registerHandlerMethod(AdminControllerHandlerMapping.java:44) ~[spring-boot-admin-server-2.1.0.jar:2.1.0]

不确定 jars 中是否存在循环依赖。有什么想法吗?

@the hand of NOD 的评论让我重新审视了我的 pom.xml 文件和 blog

中提供的 pom.xml 文件

问题出在spring-boot-starter-parent的版本号上。本教程使用 2.1.0.RELEASE 版本,而从 Spring Intializr 准备项目时的最新版本是 2.2.1.RELEASE

我降级到 2.1。0.RELEASE 成功了!对于 2.2.1.RELEASE 有一些依赖性会与 spring-boot-admin-starter-server

循环

P.S。似乎以代码为中心的团队已经在努力,并将在 2019 年 11 月 22 日之前发布 2.2.0 兼容版本 (https://github.com/codecentric/spring-boot-admin/milestones)

我升级 spring-boot-admin-starter-admin 到 2.2.4 并使用 spring-boot-starter-parent 2.2.8.RELEASE, spring-boot-admin-starter-client 2.1.6 在服务的 pom