SpringBoot - Spring Boot 2.3.0 M1发行说明


1、从Spring 2.2 进行升级所需要的注意事项

1、废弃的一些类。

在SpringBoot 2.2中被废弃的类、方法和属性在这个版本中已经被删除。在升级之前,请确保您没有调用不推荐的方法

可以参考官方文档
1、https://github.com/spring-projects/spring-boot/pull/19189
2、https://github.com/spring-projects/spring-boot/pull/19699


2、内置组件的版本最低要求升级

如果你使用Gradle,需要的最低版本是 5.6 以上
如果你使用Jetty 嵌入式容器,需要的最低版本是 9.4.22以上

3、Springcloud 相关

移除了 Spring Cloud Connectors starter 组件,并推荐使用 Java CFEnv 进行代替

4、验证相关
spring-boot-starter-validation 模块不再默认包含,如果需要使用者个模块,需要在POM 文件中显式的进行引用才可以

5、ElasticSearch传输变化

原生Elasticearch传输在以前的SpringBoot版本中被废弃,因为Elasticearch和Spring数据本身在下一个版本中不支持它。此支持已在SpringBoot中删除

具体详情请参考Spring 官方文档
https://github.com/spring-projects/spring-boot/issues/19668

另外,Elasticsearch现在提供了一个官方的HTTP客户机,Spring数据作为传输支持它。对Jest库的支持已在SpringBoot2.2.0中被废弃,并已从SpringBoot中删除

参考:https://github.com/spring-projects/spring-boot/pull/19681

Spring Boot现在默认使用ElasticSearch 7.5+

6、Cassandra 升级

Spring Boot现在默认使用Cassandra 4.3+。这个新的驱动程序有一些破坏的变化,暂时Spring 团队还是处理当中

如果你是依靠ClusterBuilderCustomizer若要自定义Cluster,这个概念在v4中不再存在,而是被两个更具体的自定义器所取代:

DriverConfigLoaderBuilderCustomizer自定义驱动程序的属性。请将其用于尚未公开的任何属性。

CqlSessionBuilderCustomizer自定义CqlSession(前Session).

此外,卡桑德拉v4驱动器不再有自动的地方直流推论从接触点。因此,必须使用默认的负载平衡策略来设置“本地数据中心”属性,并且接触点必须位于该数据中心。新的spring.data.cassandra.local-datacenter属性以轻松设置本地数据中心。

最后,联络点现在以host:port。确保更新配置以指定每个接触点要使用的端口

2、支持用云本地构建包构建Docker映像

Support for building Docker images using Cloud Native Buildpacks has been added to the Maven and Gradle plugins via the spring-boot:build-image goal and the bootBuildImage task.

支持使用Native 的构建包构建docker 镜像,他已经被加入到Maven 和Gradle 插件里面

3、支持构建分层jar,以便于打包在docke的镜像中

Maven和Gradle插件已经添加了对构建内容分离为层的JAR文件的支持。分层根据JAR的更改频率将其内容分隔开来。这种分离允许建立更高效的Docker 镜像。未更改的现有层可与已更改的层放在顶部重用

分层JAR还为通过新的JAR模式列出和提取其层提供了内置支持。要查看可用的选项,请使用-Djarmode=layertools,如以下示例所示

$ java -Djarmode=layertools -jar build/libs/layered-app-0.0.1-SNAPSHOT.jar 
Usage:
  java -Djarmode=layertools -jar layered-app-0.0.1-SNAPSHOT.jar

Available commands:
  list     List layers from the jar that can be extracted
  extract  Extracts layers from the jar for image creation
  help     Help about any command

4、现在已经支持了配置属性的端到端的可跟踪性质

/actuator/configprops端点提供有关配置属性的端到端信息,将其行为与环境端点对齐.例如,在添加server.server-header=Spring Boot在你的application.properties,端点将显示以下内容:

"serverHeader": {
  "origin": "class path resource [application.properties]:2:22",
  "value": "Spring Boot"
},

具体的开业去参考一下官方的文档
https://github.com/spring-projects/spring-boot/issues/17886

5、对大型Jar 包的友好支持

使用Maven和Gradle构建的FAT JAR现在包括一个索引文件,当jar 包越来越大的时候,这个索引文件用于确保类路径的排序与直接执行JAR时相同。

6、进行了一系列的依赖升级

Spring Data Neumann

Spring HATEOAS 1.1

Spring Integration 5.3

Spring Kafka 2.4

Spring Security

7、更新了第三方的一些依赖,其中主要的需要关注的如下

AssertJ 3.14

Elasticsearch 7.5

Flyway 6.1

Hibernate Validator 6.1

Infinispan 10.1

Kafka 2.4

Mockito 3.2

8、对JPA 的变更

JPA 的一些配置的默认值改掉了,具体参考着2个地方的文档

https://github.com/spring-projects/spring-boot/issues/16230

https://github.com/spring-projects/spring-boot/issues/16747

9、配置项的更改

这个spring.http.属性已移动到server.servlet.encoding., spring.mvc.和spring.codec

详细说明文档:https://github.com/spring-projects/spring-boot/issues/18827

发布了442 篇原创文章 · 获赞 1375 · 访问量 210万+

猜你喜欢

转载自blog.csdn.net/qq_15071263/article/details/104080562