Spring Boot 2.1 缓存执行器不存在

D. *_*ger 3 java spring spring-boot spring-boot-actuator

我已经设置了一个基于版本 2.1 的简​​单 Spring Boot 应用程序(https://github.com/dkellenb/spring-boot-2.1-cache-actuator-missing)。我找不到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");
    }
}
Run Code Online (Sandbox Code Playgroud)

对于 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>
Run Code Online (Sandbox Code Playgroud)

我也测试过

endpoints.caches.enabled=true
management.endpoints.web.exposure.include=info,health,cache
Run Code Online (Sandbox Code Playgroud)

请注意,缓存执行器可用于 JMX,但在 Web 上。

D. *_*ger 5

原因是: