Skip to content
Advertisement

Error processing condition on org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration

I am a novice Java Spring programmer. I am moving some test code from an older jHipster project to a new one. I added this to the pom.xml to fix a compilation error. This fixed my compilation issue but caused runtime errors.

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-actuator</artifactId>
   <version>1.5.7.RELEASE</version>
</dependency>

I am now getting these runtime errors.

Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration Caused by: java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.actuate.metrics.MetricsEndpoint]

 <spring-boot.version>2.2.5.RELEASE</spring-boot.version>

If I remove spring-boot-actuator

incompatible types: java.time.Instant cannot be converted to java.util.Date cannot access org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter method does not override or implement a method from a supertype

Does anyone know how to fix?

Advertisement

Answer

There seems to be an issue with the dependency. First, do not specify the version unless you are very sure there won’t be any dependency conflicts. This is one reason spring-boot is so popular that you need not to worry about dependencies and their compatibility. Let spring-boot handle that. The compatible version will inherit from the parent.

The other issue is, why use spring-boot-actuator? you should be using the spring-boot-starter-actuator

Here’s a sample pom

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

And then in dependencies

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <scope>provided</scope>
    <!-- Spring will find the version compatible with the parent -->
</dependency>

Hope this helps

Advertisement