最好的方法是使用扩展执行器端点
@EndpointWebExtension。您可以执行以下操作;
@Component@EndpointWebExtension(endpoint = HealthEndpoint.class)public class HealthEndpointWebExtension { private HealthEndpoint healthEndpoint; private HealthStatusHttpMapper statusHttpMapper; // Constructor @ReadOperation public WebEndpointResponse<Health> health() { Health health = this.healthEndpoint.health(); Integer status = this.statusHttpMapper.mapStatus(health.getStatus()); // log here depending on health status. return new WebEndpointResponse<>(health, status); }}更多关于执行器终点延伸这里,在 4.8。
扩展现有端点



