Hello.
I use Maven to configure dependencies. My project use Spring Boot 2.6.2 parent like so:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
today I added Actuator like so:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- Exclude the Tomcat dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Use Jetty instead -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Once I started my tests I got error about class not found:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: io/micrometer/core/instrument/binder/system/DiskSpaceMetrics
Look at https://github.com/spring-projects/spring-boot/blob/4256344c80a2dcb7de93383f47d08aca0522ab28/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java#L25
I found that DiskSpace Metrics has been moved from jvm package to the system: https://github.com/micrometer-metrics/micrometer/issues/2750. After that I listed the project dependencies by ./mvnw dependency:tree
and found that the actuator-autoconfigure uses older micrometer-core 1.7.3 instead of 1.8.x:
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.2:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.2:compile
[INFO] | | \- org.springframework.boot:spring-boot-actuator:jar:2.6.2:compile
[INFO] | \- io.micrometer:micrometer-core:jar:1.7.3:compile
I would put newer micrometer-core into my pom.xml, but please check your configurations and make sure that spring-boot-starter-actuator:jar:2.6.x uses micrometer-core:jar:1.8.x.
Thank you.
Comment From: bclozel
Looks similar to #28929. Is some other dependency managing the micrometer version?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: ghost
Looks similar to #28929. Is some other dependency managing the micrometer version?
I agree that it is similar to #28929 - I use Azure SDK as well and it seems to force the micrometer version.
Comment From: wilkinsona
Judging by the names, I'm guessing that @vg-appsdirect and @vgarmash are the same person so I'll close this one as a duplicate. It would appear that the problem with the Azure bom may have been fixed in 3.12.