我实施了:implementation("org.springframework.boot:spring-boot-starter-actuator:3.0.1")
依存关系,并添加了:management: endpoints: web: exposure: include: "*"
发送到application.yml
,当我发送请求到POSTMAN
时:
网址:
除指标外,所有必需的端点都可用
我该如何添加此内容?
我试着补充道:
@Autowired
private MeterRegistry meterRegistry;
@Bean
public CacheMetricsRegistrar cacheMetricsRegistrar() {
return new CacheMetricsRegistrar(meterRegistry, Lists.newArrayList(new CaffeineCacheMeterBinderProvider()));
}
但我得到了一个错误〉进程'command 'C:/Program Files/Java/jdk-17/bin/java.exe''
以非零退出值1结束
1条答案
按热度按时间wz8daaqr1#
您是否尝试过通过yaml/properties启用它?
参考:www.example.comhttps://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.metrics