With Spring Boot 2.2.0 the "httptrace" Actuator endpoint doesn't exist anymore. How can I get this functionality back?
The functionality has been removed by default in Spring Boot 2.2.0.
As a workaround, add this configuration to the Spring environment:
management.endpoints.web.exposure.include: httptrace
and provide an HttpTraceRepository
bean like this:
@Configuration
// @Profile("actuator-endpoints")
// if you want: register bean only if profile is set
public class HttpTraceActuatorConfiguration {
@Bean
public HttpTraceRepository httpTraceRepository() {
return new InMemoryHttpTraceRepository();
}
}
http://localhost:8080/actuator/httptrace works again.
You need to enable httptrace by having following application properties. By default it is disabled
management.trace.http.enabled: true
management.endpoints.web.exposure.include: httptrace
and Requires an HttpTraceRepository
bean. You can use Your own Custom implementation or InMemoryHttpTraceRepository
management.endpoints.web.exposure.include: httptrace (or '*')
is definetly required, yes. But according to the release notes (and my own testing) management.trace.http.enabled: true
is not required, although it can be used to disable this feature even if a HttpTraceRepository bean is present. Sorry for the circumstances! –
Strophanthus For Spring Boot 3+, you should use:
@Bean
public InMemoryHttpExchangeRepository createTraceRepository() {
return new InMemoryHttpExchangeRepository();
}
More details can be found in the migratuon guide
Here's the complete setup for enabling and using the httpexchanges
functionality in Spring Boot 3.
Configuration Class
package com.openclassrooms.watchlist.actuator;
import org.springframework.boot.actuate.web.exchanges.HttpExchangeRepository;
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class HttpTraceActuatorConfiguration {
@Bean
public HttpExchangeRepository createTraceRepository() {
return new InMemoryHttpExchangeRepository();
}
}
application.properties
management.endpoints.web.exposure.include=httpexchanges
management.httpexchanges.recording.enabled=true
This setup will enable you to record and access HTTP exchange information using the /actuator/httpexchanges
endpoint
Test
© 2022 - 2025 — McMap. All rights reserved.