---
title: "Automatic Instrumentation"
description: "Learn what transactions are captured after tracing is enabled."
url: https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/automatic-instrumentation/
---

# Automatic Instrumentation | Sentry for Spring Boot

Capturing transactions requires that you first [set up tracing](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing.md) if you haven't already.

### [Spring MVC Integration](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/automatic-instrumentation.md#spring-mvc-integration)

Sentry Spring Boot integration, once enabled, captures each incoming Spring MVC HTTP request and turns it into a transaction with `SentryTracingFilter`. Transaction names follow pattern `<HTTP method> <Spring MVC route>`, for example for a request to a following controller:

```java
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@RestController
class HelloController {

  @GetMapping("/person/{id}")
  Person person(@PathVariable Long id) {
    ...
  }
}
```

Each sampled request executed by this controller method will be turned into a transaction `GET /person/{id}`.

### [RestTemplate Instrumentation](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/automatic-instrumentation.md#resttemplate-instrumentation)

Sentry Spring Boot integration provides `SentrySpanRestTemplateCustomizer` that creates a span for each outgoing HTTP request executed with a `RestTemplate`. To use instrumented `RestTemplate` make sure to create `RestTemplate` beans using `RestTemplateBuilder`:

```java
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.web.client.RestTemplate;

@Configuration
class AppConfig {
  @Bean
  RestTemplate restTemplate(RestTemplateBuilder builder) {
    return builder.build();
  }
}
```

### [RestClient Instrumentation](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/automatic-instrumentation.md#restclient-instrumentation)

Sentry Spring Boot integration provides `SentrySpanRestClientCustomizer` that creates a span for each outgoing HTTP request executed with a `RestClient`. To use instrumented `RestClient` make sure to create `RestClient` beans using `RestClient.Builder`:

```java
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestClient;

@Configuration
class AppConfig {
  @Bean
  RestClient restClient(RestClient.Builder builder) {
    return builder.build();
  }
}
```

### [WebClient Instrumentation](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/automatic-instrumentation.md#webclient-instrumentation)

Sentry Spring Boot integration provides `SentrySpanWebClientCustomizer` that creates a span for each outgoing HTTP request executed with a `WebClient`. To use instrumented `WebClient` make sure to create `WebClient` beans using `WebClient.Builder`:

```java
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
class AppConfig {
  @Bean
  WebClient webClient(WebClient.Builder builder) {
    return builder.build();
  }
}
```
