Spring Boot 4.2 and Spring Framework 7.1 - What is new for the developers

Spring Boot 4.2 and Spring Framework 7.1 - What is new for the developers

Spring Boot 4.2.0 was released on November 19, 2026, bringing Spring Framework 7.1.0, Spring Data 2026.1.0, Spring Security 7.2.0 and several other dependency upgrades.

You can see the API changes for Spring Boot in my utility website:

What changes for me as developer

There are a lot of changes in each Spring Boot release, in this post I will focus mainly on the changes that are important for the my and my team activity. E.g. in SB 4.2 there are changes related to RabbitMQ, we don't use it, I'll mention but I cannot give an opinion on the impact of the changes.

RestTemplate is officially deprecated

This change was expected and for my projects is the one with the biggest impact.

Spring Framework 7.1 officially deprecates RestTemplate. Its removal is planned for Spring Framework 8.0. You can still use it, but you should plan the migration towards RestClient that is present since Spring Framework 6.1.

RestTemplate is used for calling external REST endpoints, e.g. you application consumes external services. This happens in many the applications and projects I participated.
In my Pet Project (the one I can freely talk) I use RestTemplate to retrieve Stock lists, Conference calls transcripts, Earning data.

The migration is not very complicated, but like every change it has potential risks.

RestClient uses a fluent API in contrast to the 'old-fashioned' imperative style of RestTemplate.

Example with RestTemplate:

@Service
public class CustomerClient {

    private final RestTemplate restTemplate;

    public CustomerClient(RestTemplateBuilder builder) {
        this.restTemplate = builder
            .rootUri("https://api.example.com")
            .build();
    }

    public Customer getCustomer(Long id) {
        return restTemplate.getForObject(
            "/customers/{id}",
            Customer.class,
            id
        );
    }
}

Here is a simple example with RestClient:

@Service
public class CustomerClient {

    private final RestClient client;

    public CustomerClient(RestClient.Builder builder) {
        this.client = builder
            .baseUrl("https://api.example.com")
            .build();
    }

    public Customer getCustomer(Long id) {
        return client.get()
            .uri("/customers/{id}", id)
            .retrieve()
            .body(Customer.class);
    }
}

For reactive applications, WebClient remains the appropriate alternative.

TestRestTemplate will be removed too

Spring Boot 4.2 also deprecates TestRestTemplate support.

One alternative is RestTestClient, which offers the fluent API alternative

For example, assuming an existing /api/customers/42 endpoint:

@SpringBootTest(
    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
@AutoConfigureRestTestClient
class CustomerApiIT {

    @Autowired
    RestTestClient client;

    @Test
    void shouldReturnCustomer() {
        client.get()
            .uri("/api/customers/42")
            .exchange()
            .expectStatus().isOk()
            .expectBody()
            .jsonPath("$.id").isEqualTo(42);
    }
}

This test starts the application on a random port and uses a real HTTP connection.

RestTestClient can also be used with MockMvc when you don't need to start a server.

References:

HTTP QUERY: a new method for complex search APIs

This is very interesting, I created a dedicated POST that you can find here:

HTTP QUERY: Between GET and POST — What's New for Spring Boot and Angular?
Complicated HTTP request, can I send a JSON Body in GET? Can I get data with POST? Here comes HTTP Query

Better REST API error handling - Problem Details

Spring Framework 7.1 makes standardized error handling (RFC 9457 Problem Details) easier to enable for Spring MVC.

Previously, many applications (most of mine) implemented a custom @ControllerAdvice extending ResponseEntityExceptionHandler.

Now, Spring MVC can render unhandled exceptions as Problem Details through an opt-in configuration:

@Configuration
public class ApiConfig implements WebMvcConfigurer {

    @Override
    public void configureProblemDetails(
            ProblemDetailsConfigurer configurer) {

        configurer.renderUnhandledExceptions(true);
    }
}

With this configuration, an unexpected exception can produce a generic HTTP 500 response:

{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "Internal Server Error"
}

The response uses application/problem+json.

Spring preserves the appropriate status and detail for framework exceptions and explicitly declared error responses, avoiding disclosure of internal exception messages.

For APIs consumed by Angular, standardized error responses are useful because the frontend can implement a common error-handling strategy.

Other changes

I cannot say a lot about these changes, I don't think they have an impact on the projects I know and I didn't investigate enough the changes.

RabbitMQ

Spring Boot 4.2 adds support for AMQP 1.0. Until now, AMQP integration was primarily associated with RabbitMQ and AMQP.

If your project currently uses:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

you need to review this dependency before upgrading.

If you want to continue using RabbitMQ with AMQP, replace it with:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-rabbitmq</artifactId>
</dependency>

The available starters are now:

ProtocolStarter
RabbitMQ AMQP 0.9spring-boot-starter-rabbitmq
RabbitMQ AMQP 1.0spring-boot-starter-amqp-rabbitmq
Generic AMQP 1.0spring-boot-starter-amqp

GitHub references:

Forwarded headers - Configuration change

Applications deployed behind Nginx, Kubernetes ingress controllers or API gateways often use forwarded headers.

These headers tell Spring Boot about the original request URL, protocol and host.

In the latest release of Spring Boot the old property:

server.forward-headers-strategy=framework

is deprecated and replaced by:

server.request.header.forwarded.strategy=framework

The supported strategies are now web-server, framework and none. The previous native value is renamed to web-server.

WebFlux multipart uploads now have default limits

Another change that could affect production applications is the introduction of default multipart limits in WebFlux.

Previously, two multipart limits were effectively unlimited by default.

Spring Framework 7.1 and Spring Boot 4.2 now use:

spring:
  webflux:
    multipart:
      max-disk-usage-per-part: 1MB
      max-parts: 50

The first limit applies to the disk usage of an individual multipart part, not necessarily the total size of the entire HTTP request.

The second limits the number of parts in one multipart request.

GitHub reference: Spring Framework #36928 — Update WebFlux multipart defaults.

7. OpenTelemetry: simpler configuration and more visible errors

Spring Boot 4.2 introduces useful observability improvements.

Faster startup and container build changes

Spring Boot 4.2 includes optimizations for executable JAR files.

Classes and resources can now be looked up directly inside nested JARs instead of opening repeated URL connections.

Other improvements target compressed JAR entries, cached resource resolution, auto-configuration sorting and DevTools restarts.

GitHub reference: Spring Boot PR #52246 — Improve executable JAR performance.

Support for JPA 4.0 / Hibernate 8.0

JPA 4.0 and Hibernate 8.0 are supported, just wait that these are implemented and released before to update the dependencies. 😄

Official references