等了很久 Spring Boot 2.6 终于发布了 !!看看有哪些东西吧
新的特性
-
Servlet应用现在支持在Cookie中添加SameSite。
-
支持在主端口或管理端口上配置健康组。
-
增强了/info管理端点,加上了Java运行时信息。
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties
# 暴露 info 端点
management.endpoints.web.exposure.include=info
management.info.java.enabled=true
- metrics 端点暴露启动和磁盘空间信息
application.properties
management.endpoints.web.exposure.include=metrics
获取某个具体的指标的详细信息: http://localhost:8080/actuator/metrics/{MetricName}
。
-
支持使用WebTestClient来测试Spring MVC
WebTestClient
主要是为了测试 Spring WebFlux 项目,这次改版之后,WebTestClient
已经支持普通的 Spring MVC 项目。
@SpringBootTest
@AutoConfigureWebTestClient
class MyMockWebTestClientTests {
@Autowired
WebTestClient webClient;
@Test
void helloWorldTest() {
webClient
.get().uri("/hello")
.exchange()
.expectStatus().isOk()
.expectBody(String.class).isEqualTo("Hello World!");
}
}
-
为spring-rabbit-stream模块增加Spring Boot默认自动配置。
-
支持对/env端点和configprops配置项中的属性添加可插拔的脱敏规则。
重要变更
-
在 Spring Boot 2.4 中弃用的类、方法和属性已在此版本中删除。
-
现在默认禁止Spring Bean之间的循环引用,如果直接使用会报错,需要开启如下设置:
spring.main.allow-circular-references=true
- 请求路径与 Spring MVC 处理映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser。你可以设置spring.mvc.pathmatch.matching-strategy为ant-path-matcher来改变它。
spring.mvc.pathmatch.matching-strategy=ant-path-matcher
-
Spring Boot 2.4 停止维护
这次Spring Boot 2.6应该是年前最重要的更新了,东西非常多。但是最劲爆的消息是Spring Boot 2.4 停止支持,是的从美东时间2021-11-18开始Spring Boot 2.4停止支持。并且官方给出了1.5.x到2.7.x的生命周期时间表:
点击下方卡片/微信搜索,关注公众号“天宇文创意乐派”(ID:gh_cc865e4c536b)
听说点赞和关注本号的都找到漂亮的小姐姐了哟且年后必入百万呀!!
往期推荐
[
@Transactional 错误集锦以及如何正确使用
](http://mp.weixin.qq.com/s?__biz=MzI4MDQ5MTUzMg==&mid=2247487967&idx=1&sn=29723aa49e0fd311c2f365126a04bc7b&chksm=ebb6f2bcdcc17baae1e0b08775ba25d3db134d9b0e67279319f13880817d765d6243a6541ed5&scene=21#wechat_redirect)
[
只需一行CSS代码,让长列表网页的渲染性能提升几倍以上!
](http://mp.weixin.qq.com/s?__biz=MzI4MDQ5MTUzMg==&mid=2247487904&idx=1&sn=b37addd369091c4bb5171db930946bf8&chksm=ebb6f2c3dcc17bd53c80430214558239775401cbc609b66d410bfe4f0cbf6b25091713c0f6ab&scene=21#wechat_redirect)
[
某APP订单系统的设计分享|干货!
](http://mp.weixin.qq.com/s?__biz=MzI4MDQ5MTUzMg==&mid=2247487904&idx=2&sn=56eac92b812e09f3d3b07077788b0d81&chksm=ebb6f2c3dcc17bd526703a49302e332e63b515a5ba162f93b67fa6635b974758585caf4e413e&scene=21#wechat_redirect)
[
JavaScript 细节和一些实际应用,了解一下
](http://mp.weixin.qq.com/s?__biz=MzI4MDQ5MTUzMg==&mid=2247487814&idx=2&sn=2e2b761acf87f8550cad528795141727&chksm=ebb6f225dcc17b33dfd7bec5e2f8ee5dd75211d4a29e37f9c05ea1052ca7cf6fed0a0123795f&scene=21#wechat_redirect)