我已经基于2.1版(https://github.com/dkellenb/spring-boot-2.1-cache-actuator-missing)设置了一个简单的spring启动应用程序。我找不到缓存执行器在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");
}
}
对于pom.xml,我添加了缓存和执行器:
<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>
此外,我还测试了
endpoints.caches.enabled=true
management.endpoints.web.exposure.include=info,health,cache
请注意,缓存执行器可用于JMX,但在web上。
发布于 2019-06-10 00:48:29
我也遇到过类似的问题,原来执行器的版本必须是spring-boot-autoconfigure-2.1.3.RELEASE.jar。
我之前的版本是spring-boot-actuator-autoconfigure-2.0.2.RELEASE.jar.在此版本中,CachesEndpointAutoConfiguration不存在。如果应用程序中存在"cachesEndpoint“bean,则此类负责创建"cacheManager”bean。
尝试2.1.3版。
https://stackoverflow.com/questions/53468702
复制相似问题