In spring-boot 2.6.0 and 2.6.1, it appears that cache.time-to-live for actuator endpoints are broken.

Read operations are not cached even if configured to be so.

Example to reproduce:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        System.setProperty("management.endpoint.health.cache.time-to-live", "10s");
        System.setProperty("management.endpoint.health.show-details", "ALWAYS");
        SpringApplication.run(DemoApplication.class, args);
    }

    @Bean
    HealthIndicator dateTimeHealthIndator() {
        return () -> Health.up()
                           .withDetail("dateTime", OffsetDateTime.now())
                           .build();
    }
}


$ date ; curl -s localhost:8080/actuator/health | jq .components.dateTimeHealthIndator
Tue Nov 30 15:48:55 PST 2021
{
  "status": "UP",
  "details": {
    "dateTime": "2021-11-30T15:48:55.284381-08:00"
  }
}

$ date ; curl -s localhost:8080/actuator/health | jq .components.dateTimeHealthIndator
Tue Nov 30 15:48:59 PST 2021
{
  "status": "UP",
  "details": {
    "dateTime": "2021-11-30T15:48:59.120667-08:00"
  }
}

According to @wilkinsona , this is likely a regression introduced by changes in https://github.com/spring-projects/spring-boot/issues/25471

Comment From: wilkinsona

Thanks for raising this, @maxxedev. AFAIK, it's just the health endpoint that's affected.