Reputation: 335
I have setup a simple spring boot application based on version 2.1 (https://github.com/dkellenb/spring-boot-2.1-cache-actuator-missing). I cannot find the reason why the cache actuator is not available at http://localhost:8080/actuator/caches .
@EnableCaching
@SpringBootApplication
@Controller
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Cacheable(cacheNames = "helloWorld")
@GetMapping
public ResponseEntity<String> hello() {
return ResponseEntity.ok("hello world");
}
}
And for the pom.xml i have added cache and actuator:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
Also i have tested with
endpoints.caches.enabled=true
management.endpoints.web.exposure.include=info,health,cache
Note that Cache Actuator is available with JMX, but on on web.
Upvotes: 4
Views: 7937
Reputation: 65
I had a similar problem and it turned out that the actuator must be be in the version spring-boot-autoconfigure-2.1.3.RELEASE.jar.
My previous version was spring-boot-actuator-autoconfigure-2.0.2.RELEASE.jar. In this version CachesEndpointAutoConfiguration not exist. This class is responsible for creating the "cachesEndpoint" bean if the "cacheManager" bean is present in the application.
Try the version 2.1.3.
Upvotes: 3
Reputation: 335
The reason was:
caches
(plural)Upvotes: 6