Repository navigation
Spring Framework 7.1 Release Notes
This is a preview page for Spring Framework 7.1.0, scheduled for November 2026.
This new generation raises its minimum requirements for the following:
- Jackson 3.1 for LTS support
- Hibernate ORM 7.3 support; runtime compatibility with Hibernate ORM 7.1 and 7.2 is retained for the time being.
- HtmlUnit 5.4 for the spring-test integration with MockMvc
We noticed that the JAXB message converter can consume a lot of CPU resources at runtime, even if XML isn't being used by the application. The "jakarta.xml.bind:jakarta.xml.bind-api" dependency is very common in Servlet applications and is often auto-detected by HttpMessageConverters as a valid choice.
As of Framework 7.1, HttpMessageConverters will not auto-detect JAXB converters for server applications. RestTemplate and RestClient will still detect it, because the CPU overhead there is less important.
You can bring back this converter in your server application with the following configuration:
@Configuration(proxyBeanMethods = false)
class JaxbConverterConfiguration implements WebMvcConfigurer {
@Override
public void configureMessageConverters(HttpMessageConverters.ServerBuilder builder) {
builder.withXmlConverter(new Jaxb2RootElementHttpMessageConverter());
}
}DefaultPartHttpMessageReader now sets default limits for maxDiskUsagePerPart to 1MB and maxParts to 50. Both had no default limits previously. The new default values align with default values set in Boot for Servlet applications. Use ServerCodecConfigurer in the WebFlux config to set a customized MultipartHttpMessageReader.
This class was formerly for internal use by Spring Security to perform path checks aligned with Spring MVC. It also implemented CorsConfigurationSource to allow CORS checks based on @CrossOrigin annotations on controllers. As a result of the removal, applications may now experience the absence of a CorsConfigurationSource bean.
HandlerMappingIntrospector was never intended for general use either directly or indirectly as CorsConfigurationSource. Generally as CORS checks are built into the DispatcherServlet there is no need to apply them anywhere else. Consequently there is no direct replacement. However, the Spring MVC config continues to expose a PreFlightHttpRequestHandler bean to handle preflight requests early as those are not authenticated and possible to handle fully early within the filter chain.
Previously it was set to the request path, but RFC 9457 defines this as a URI identifier for a specific occurrence of the problem, potentially also returning information about the problem. A plain request path doesn't meet that definition. Applications can set the field directly on ProblemDetail or ErrorResponse locally, or configure an ErrorResponse.Interceptor through the MVC or WebFlux Java config.
Exceptions that are translated to a 5xx response by ResponseEntityExceptionHandler (MVC and WebFlux), ResponseStatusExceptionResolver and DefaultHandlerExceptionResolver are now recorded as the error of the current HTTP server observation (#37384). Previously, these exceptions were handled without the observation seeing them.
As a result, for such requests:
- The
errorkey of thehttp.server.requestsmetrics is now the exception name instead ofnone. - Traces mark the server span as failed and carry the exception.
Client errors (4xx) are never recorded, so dashboards and alerts on those are unchanged.
Applications that rely on the previous behavior, for example alerts that count a non-none error value as an unexpected failure, may see more server errors than before. These requests were already counted with outcome=SERVER_ERROR, but without the exception. The change can be reverted for specific exceptions with a custom ObservationConvention that ignores the error.
Prior to Framework 7.1, calling RestClient.Builder#configureMessageConverters (or the RestTestClient.Builder variant) turned off the auto-detection of default message converters: only converters configured explicitly were registered, unless registerDefaults() was called (#36747). As of Framework 7.1, the HttpMessageConverters.ClientBuilder always starts from the default converters, which aligns with the Spring MVC and WebClient configuration. Overriding a single converter with withJsonConverter or adding one with addCustomConverter now keeps all other default converters.
Applications that relied on the previous behavior to configure a minimal set of converters should now disableDefaults() explicitly.
Converters set with the deprecated RestClient.Builder#messageConverters methods are not affected. Spring Boot applications using the auto-configured RestClient.Builder are not affected either, since Boot already registers default converters.
- As announced in the state of HTTP clients in Spring blog post,
RestTemplateand related types are formally deprecated as of 7.1. Their actual removal is scheduled for Spring Framework 8.0 (not yet scheduled). - The default constructors of
ForwardedHeaderFilter(Spring MVC) andForwardedHeaderTransformer(WebFlux) have been deprecated in favour of a new one with a boolean argument whether to use the standard "Forwarded" header or the "X-Forwarded" alternative headers. A separate property enables use of "X-Forwarded-Prefix" if needed. This makes forwarded header processing more deterministic and aligned with what is expected from the proxy. Please, see the updated Security Considerations section, as well as related changes in Spring Boot https://github.com/spring-projects/spring-boot/issues/51030. - The
AllEncompassingFormHttpMessageConverteris deprecated in favor of the newMultipartHttpMessageConverter. It is not configured by default anymore in HTTP clients and server applications. - The
disallowedFieldsproperty ofDataBinderis deprecated as it is fragile and easy to get out of sync with the actual properties over time. Please use constructor binding, a model object designed for the expected inputs, orallowedFieldsinstead. - the Apache Derby project is retired since 2023 and this release deprecates its support.
-
org.springframework.beans.PropertyAccessorUtilshas been deprecated in favor of the newPropertyPathtype and its dedicated parser. This introduces a tighter grammar and parsing for bean property paths in general.
Spring Framework 7.1 extends its optional support for the upcoming JPA 4.0 and Hibernate ORM 8.0, building on the EntityAgent support from #36025:
-
@PersistenceAgentinjection is supported byPersistenceAnnotationBeanPostProcessor(#36264). -
PersistenceUnitInfoimplementations expose the new JPA 4.0 package and module descriptor discovery callbacks. Annotatedmodule-infoclasses are discovered next topackage-infoclasses (#37316). -
SpringBeanContaineris aligned with the revised Hibernate 8.0BeanContainerSPI, including lazy access to "bootstrap-safe" beans. This also fixesMultiTenantConnectionProvider, which Hibernate now retrieves as a managed bean (#37381).
Existing applications can already run against Hibernate 8.0 on Spring Framework 7.0.10, which provides the same behavior as with JPA 3.2 and Hibernate 7.x (#37315). The new JPA 4.0 features need 7.1.
RFC 10008 introduces the new QUERY HTTP method. This spans the gap between GET and POST: QUERY is an idempotent method with a request body. This is a brand new standard and the industry is starting to adopt it. This release ships minimal support to unlock your typical use case.
For example:
@RestController
public class TestController {
@RequestMapping(method = RequestMethod.QUERY, path = "/form", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ResponseEntity<String> form(@RequestParam String name) {
return ResponseEntity.ok("hello: " + name);
}
@RequestMapping(method = RequestMethod.QUERY, path = "/body", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> body(@RequestBody Project project) {
return ResponseEntity.ok("project: " + project.id);
}
public record Project (String name, String id) {
}
}You can test these endpoints with the following curl commands:
$ curl -X QUERY -d "name=spring" http://localhost:8080/form
$ curl -X QUERY -H "Content-Type: application/json" -d '{"name":"Spring Framework", "id":"spring-framework"}' http://localhost:8080/body
We are not shipping a @QueryMapping annotation or DSL extensions for now; we will gradually add more features as industry adoption increases.
Before Spring Framework 7.1, Multipart payloads could be read/written in Spring MVC applications with the Servlet Multipart Resolver support. RestTemplate and RestClient could send Multipart requests thanks to the FormHttpMessageConverter. This means HTTP clients could not read multipart responses and you couldn't thoroughly test your Multipart endpoints with RestTestClient.
As of 7.1, Spring Framework now dedicates FormHttpMessageConverter to URL encoded forms and ships a new MultipartHttpMessageConverter that can write and read Multipart payloads.
Check out in the reference documentation how RestClient can parse Multipart responses as MultiValueMap and how you can use RestTestClient to test your Multipart server endpoints.
When using RestTestClient with MockMvc, integration tests will now support handling multipart requests sent by RestTestClient.
Spring MVC can now render any unhandled exception as an RFC 9457 problem detail, without requiring a @ControllerAdvice that extends ResponseEntityExceptionHandler (#37380).
This is opt-in through WebMvcConfigurer:
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void configureProblemDetails(ProblemDetailsConfigurer configurer) {
configurer.renderUnhandledExceptions(true);
}
}With this enabled, exceptions that no @ExceptionHandler method handles are rendered as application/problem+json responses (#37398):
-
ErrorResponseexceptions,ResponseStatusExceptionand@ResponseStatusexceptions keep their status and detail. - Framework exceptions get the same status and detail as
ResponseEntityExceptionHandler. - Any other exception results in a generic 500 response. The exception message is never exposed.
- Type, title and detail can be customized through the
MessageSource.
Browsers can get an HTML error page instead of JSON. An ErrorResponseViewResolver is called when the client prefers HTML, so applications can render problem details with their own error templates (#37400):
configurer.viewResolver((request, problemDetail, errorResponse) ->
new ModelAndView("error/" + problemDetail.getStatus(),
Map.of("problem", problemDetail)));