Due to changes in micrometer-core, spring-boot-starter-actuator was updated in issue #27688 to handle the fact that micrometer have changed the package that DiskSpaceMetrics is in (it's now in io.micrometer.core.instrument.binder.system.DiskSpaceMetrics).
The problem is that micrometer-core did that change in the 1.8.* versions but spring-boot-starter-actuator (2.6.1) is pulling in the older 1.7.3 version of micrometer-core which has that class in the old package.
This results in a java.lang.NoClassDefFoundError when initialising the SimpleMetricsExportAutoConfiguration bean.
I was able to work around this problem locally by adding an explicit dependency to micrometer-core 1.8.1 in my pom:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.8.1</version>
</dependency>
Comment From: wilkinsona
Spring Boot 2.6 should use Micrometer 1.8 by default. Can you please provide a minimal example that shows 1.7.3 being used?
Comment From: antti-markus-cko
Spring Boot 2.6.1 uses Micrometer 1.8.0 by default - https://github.com/antti-markus-cko/issuedemo
./gradlew dependencyinsight --dependency micrometer
gives
> Task :dependencyInsight
io.micrometer:micrometer-core:1.8.0 (selected by rule)
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes)
org.gradle.category = library
Requested attributes not found in the selected variant:
org.gradle.dependency.bundling = external
org.gradle.jvm.environment = standard-jvm
org.gradle.jvm.version = 17
]
io.micrometer:micrometer-core:1.8.0
\--- org.springframework.boot:spring-boot-starter-actuator:2.6.1
\--- compileClasspath (requested org.springframework.boot:spring-boot-starter-actuator)
Comment From: SingingBush
that's weird, when I do mvn dependency:tree the only dependency pulling in micrometer-core is spring-boot-starter-actuator and the version is 1.7.3:
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.1:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.1:compile
[INFO] | | +- org.springframework.boot:spring-boot-actuator:jar:2.6.1:compile
[INFO] | | \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.5:compile
[INFO] | \- io.micrometer:micrometer-core:jar:1.7.3:compile
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
Comment From: snicoll
@SingingBush That doesn't mean anything if the version was forced by some dependency management in your project. As Andy requested, please share a small sample we can run ourselves that reproduces this.
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: Killianoc
I had this same issue and as @snicoll said it was due to a version being forced by dependency management. In my case it was "azure-spring-boot-bom:3.11.0" forcing version 1.7.3 of micrometer-core.
As OP said, either directly importing micrometer-core will fix this, or else you can exclude it from the direct dependencies (unfortunately I couldn't exclude it at maven dependency management level as Maven doesn't like that, at least at my version of it)
Comment From: snicoll
@Killianoc than you for bringing this to my attention. I've reported the issue to Azure.
Comment From: snicoll
It's been a while and with a lack of a repro that showcases the problem, I am going to close this now.
Comment From: sandy11apr
@snicoll @SingingBush What is the solution I have the same problem.
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.6:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.6.6:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:2.6.6:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.6:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.6:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] | +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.6:compile
[INFO] | | +- org.springframework.boot:spring-boot-actuator:jar:2.6.6:compile
[INFO] | | \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.2:compile
[INFO] | **\- io.micrometer:micrometer-core:jar:1.6.2:compile**
[INFO] | +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
Comment From: scottfrederick
@sandy11apr It's likely that dependency management in your project is overriding the version of micrometer-core that is managed by Spring Boot. We can't tell what that is just from the dependency graph, we'd need to see a sample project to provide more information.