扫码阅读
手机扫码阅读

Spring Boot 3.2 提供对虚拟线程以及 RestClient 和 JdbcClient 的支持

110 2024-07-04

我们非常重视原创文章,为尊重知识产权并避免潜在的版权问题,我们在此提供文章的摘要供您初步了解。如果您想要查阅更为详尽的内容,访问作者的公众号页面获取完整文章。

查看原文:Spring Boot 3.2 提供对虚拟线程以及 RestClient 和 JdbcClient 的支持
文章来源:
InfoQ
扫码关注公众号
Spring Boot 3.2 Release Summary

Spring Boot 3.2 Release Summary

Author: Sirisha Pratha
Translator: 张卫滨
Planner: 丁晓昀

Main Features

The release of Spring Boot 3.2 in November 2023 by the Spring Boot team introduces several features, with key enhancements including support for virtual threads and CRaC (Coordinated Restore at Checkpoint). Additional features cover SSL Bundle reloading, support for RestClient and JdbcClient interfaces, and improvements in observability.

Support for Virtual Threads

In JDK 21, the Loom project's virtual threads, described as lightweight threads by JEP, are integrated into Spring Boot 3.2. Enabling virtual threads requires setting the property spring.threads.virtual.enabled to true and utilizing JDK 21. With virtual threads enabled, servers like Tomcat and Jetty, as well as Spring's SimpleAsyncTaskExecutor, will operate on virtual threads, impacting web request processing, asynchronous methods with @EnableAsync, and blocking calls in Spring MVC and Spring WebFlux.

RestClient and JdbcClient Interfaces

RestClient, a modern alternative to RestTemplate, is now provided by Spring Boot through preconfigured instances, offering a functional API similar to WebClient in Spring WebFlux, without the need for additional dependencies. JdbcClient, introduced in Spring Framework 6.1, features a fluent API for common database operations and is auto-configured in Spring Boot 3.2.

SSL Bundle Reloading

Building on SSL Bundle features introduced in Spring Boot 3.1 for managing SSL materials, Spring Boot 3.2 allows hot reloading of SSL bundles when trust material changes by setting reload-on-update=true. This is supported by Netty and Tomcat web servers, with configurations for quiet periods using spring.ssl.bundle.watch.file.quiet-period=10s.

Enhancements in Observability

Spring Boot 3.2 enhances observability, allowing declarative use of Micrometer annotations when spring-boot-starter-aop is on the classpath. Methods annotated with @Scheduled are instrumented for observability. The release also introduces a replacement for the deprecated management.metrics.tags with management.observations.key-values for adding key-value pairs to observations.

Developer Insights

Josh Long from Broadcom, a Spring developer advocate, emphasizes that it is an excellent time to be a Spring and Java developer. With support for the CRaC project and the Loom project (available from Java 21), combined with existing support for GraalVM native images, Spring Boot 3.2 offers optimal runtime efficiency and an exceptional production experience for developers. For a complete list of noteworthy changes and upgrade details, refer to the official release notes.

想要了解更多内容?

查看原文:Spring Boot 3.2 提供对虚拟线程以及 RestClient 和 JdbcClient 的支持
文章来源:
InfoQ
扫码关注公众号

为一线互联网公司核心技术人员提供优质内容。科技圈的观察者,前沿技术的传播者。

98 篇文章
浏览 13.7K
加入社区微信群
与行业大咖零距离交流学习
软件研发质量管理体系建设 白皮书上线