Spring framework 5.1 new features
Here are features of spring 5.1
General Core Revision
-
Infrastructure:
-
Warning-free support for JDK 11 on the classpath and the module path.
-
Support for Graal native image constraints (reflection, parameter names).
-
Upgrade to Reactor Core 3.2 and Reactor Netty 0.8 ("Reactor Californium").
-
Upgrade to ASM 7.0 and CGLIB 3.2.8.
-
-
Core facilities:
-
NIO.2 Path support in FileSystemResource (superseding PathResource).
-
Performance improvements for core type and annotation resolution.
-
Consistent detection of method annotations on generic interfaces.
-
-
Logging revision:
-
Spring's JCL bridge can be detected by standard Commons Logging.
-
Less noise on info, readable debug logs, details at trace level.
-
Core Container
-
Bean definitions:
-
Support for logical and/or expressions in @Profile conditions.
-
Consistent (non-)detection of nested configuration classes.
-
Refined Kotlin beans DSL.
-
Unique implicit bean names for multiple beans ofsame type.
-
-
-
Bean retrieval:
-
Consistent non-exposure of null beans in the BeanFactory API.
-
Programmatic ObjectProvider retrieval through the BeanFactory API.
-
ObjectProvider iterable/stream access for beans-of-type resolution.
-
Empty collection/map/array injection in single constructor scenarios.
-
General Web Revision
-
Controller parameter annotations get detected on interfaces as well:
-
Allowing for complete mapping contracts in controller interfaces.
-
-
Support for stricter encoding of URI variables in
UriComponentsBuilder
:-
See updated "URI Encoding" in the reference.
-
-
Servlet requests params with HTTP PUT, PATCH, and DELETE:
-
See "Form Data".
-
Spring Web MVC
-
Logging
-
Improved, human-friendly, compact, DEBUG and TRACE logging.
-
Control over DEBUG logging of potentially sensitive data.-
via
DispatcherServlet#enableLoggingRequestDetails
-
-
-
Updated web locale representation:
-
Language tag compliant by default.
-
CookieLocaleResolver sends RFC6265-compliant timezone cookies.
-
-
Specific MVC exceptions for missing header, cookie, path variable:
-
Allowing for differentiated exception handling and status codes.
-
-
Externally configured path for sets of annotated controllers.base -
Centralized handling of "forwarded" type headers via
ForwardedHeaderFilter
:-
Please see important upgrade note.
-
-
Support for serving Brotli, in addition to GZip, pre-encodedstatic resources .
Spring WebFlux
-
HTTP/2 server support when running with Reactor Netty 0.8.
-
Logging
-
Improved, human-friendly, compact, DEBUG and TRACE logging.
-
Correlated log messages for HTTP requests and WebSocket sessions.
-
Control over DEBUG logging of potentially sensitive data.-
via
CodecConfigurer#defaultCodecs
-
-
-
Session cookies now have
SameSite=Lax
to protect against CSRF attacks:-
See OWASP page and this article.
-
-
DSL enhancements:
-
DSL-style builder for
RouterFunction
without static imports (sample). -
Refined Kotlin router DSL.
-
-
Externally configured path for sets of annotated controllers.base -
Third-party integration:
-
Support for Protobuf serialization, including message streaming.
-
WebClient
connector for the Jetty reactive HTTP Client.
-
-
WebSocket:
-
Support for
WebSocketSession
attributes. -
Improve docs on reactive WebSocket API handling.
-
-
Support for serving Brotli, in addition to GZip, pre-encodedstatic resources .
Spring Messaging
-
Support for reactive clients in @MessageMapping methods:
-
Out-of-the-box support for Reactor and RxJava return values.
-
-
Option to preserve publication order of messages by STOMP broker. -
@SendTo
and@SendToUser
can both be used on controller method. -
Improved docs onhandling messages and subscriptions.of
Spring ORM
-
Support for Hibernate ORM 5.3:
-
Bean container integration with Hibernate's new SPI.
-
-
LocalSessionFactoryBean and HibernateTransactionManager support JPA interaction:
-
Allowing for native Hibernate as well as JPA access within the same transaction.
-
-
Read-only transactions do not retain Hibernate entity snapshots in memory anymore:
-
Session.setDefaultReadOnly(true) by default.
-
-
SAP HANA as a common JpaVendorAdapter database platform.
Testing
-
Hamcrest and XML assertions in
WebTestClient
. -
MockServerWebExchange
can be configured with fixedWebSession
Related Source: