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

I am following this blog to try out a Spring-Boot-Admin application. And when I run the app it fails with the below error:

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.StackOverflowError

I look further below and find these below lines:

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.StackOverflowError: 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]

Not sure if there is some circular dependency in the jars. Any idea please?



Solution 1:[1]

The comment by @the hand of NOD made me relook into my pom.xml file and the pom.xml file provided in the blog

The problem lies in the version number of the spring-boot-starter-parent. The tutorial uses a version 2.1.0.RELEASE whereas the latest one when you prepare a project from Spring Intializr is 2.2.1.RELEASE

I downgraded to 2.1.0.RELEASE and it worked! With 2.2.1.RELEASE there is some dependency that is going cyclic with spring-boot-admin-starter-server

P.S. It seems that the codecentric team is already working upon it and would release the 2.2.0 compliant version by 22 Nov 2019 (https://github.com/codecentric/spring-boot-admin/milestones)

Solution 2:[2]

It works for me upgrade spring-boot-admin-starter-admin to 2.2.4 and using spring-boot-starter-parent 2.2.8.RELEASE, spring-boot-admin-starter-client 2.1.6 on service's pom

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Martin Estrada