How to Enable Actuator’s HttpTrace in Spring Boot 3

In this tutorial, you will learn how to enable the Actuator’s httpTrace endpoint in Spring Boot 3. In fact, /httptrace has been renamed to /httpexchanges, so this tutorial will teach you how to enable the Actuator’s /httpexchanges API endpoint instead of /httptrace.

The httpexchanges endpoint provides information about HTTP request-response exchanges. To learn more, check out the documentation page.

Step 1. Add Actuator Dependency

The first step is to add actuator dependency to your project.

Maven Dependency

If your project is maven-based, then add the following dependency to pom.xml file.


Gradle Dependency

If your project is Gradle-based, add the following dependency to your build.gradle file.

ependencies {
    compile 'org.springframework.boot:spring-boot-starter-actuator'

Step 2. Enable /actuator/httpexchanges Endpoint

By default, the /actuator/httpexchanges endpoint is disabled in Spring Boot 3. To enable it, you will need to add the following to your file:


To enable all API endpoints, use the following property value instead:


Step 3. Create InMemoryHttpExchangeRepository Bean

For the HttpExchanges API endpoint to work in Spring Boot 3, create a Bean of HttpExchangeRepository type. To do that, add to your project the following Configuration class.

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;

public class ActuatorHttpExchangesConfiguration {
    public HttpExchangeRepository httpTraceRepository()
        return new InMemoryHttpExchangeRepository();

Step 4. Access Actuator HttpExchanges Endpoint

At this moment, the /actuator/httpexchanges endpoint should be enabled. So your next step will be to Build and Run your Spring Boot application.

Once your application is up and running, open the following URL in the browser window:


Refresh the page, and you should get a similar response in response:

                  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"
                  "gzip, deflate"
                  "Thu, 29 Dec 2022 22:03:56 GMT"

I hope this tutorial was helpful to you. Check out the Spring Cloud and Spring Boot tutorials pages to learn more.

Happy learning!