史上最全SpringBoot2.1.0.RELEASE版本特性介绍(全⽂英译
版)
Spring Boot 2.1.RELEASE
Spring Boot 2.1 Release Notes
Upgrading from Spring Boot 2.0
Deprecations from Spring Boot 2.0
在Spring Boot 2.0中弃⽤的类、⽅法和属性已经在这个版本中删除了。请确保在升级之前没有调⽤已弃⽤的⽅法。
Spring Framework 5.1
Spring Boot 2.1 使⽤ Spring Framework 5.1. 请参考它的升级指南-upgrade guide,了解任何可能影响您的应⽤程序的更改。
Bean Overriding
默认情况下禁⽤了Bean重写,以防⽌Bean被意外地重写。如果依赖于重写,则需要设置spring.main.allow-bean-definition-overriding=true.
Auto-Configuration Exclusion
排除现在被⼀致地应⽤,⽽不仅仅是局部地应⽤。这适⽤于在
@EnableAutoConfiguration, @SpringBootApplication, @ImportAutoConfiguration或 lude属性。
Actuator 'info' and 'health' Endpoint Security
如果spring-security在没有任何安全配置的类路径上,那么/info和/health现在将公开以保持⼀致性。如果在类路径上有spring-security,但不提供任何安全配置,则需要显式保护它们。
Servlet Path
The server.servlet.path property has moved to spring.mvc.servlet.path. If you were relying on that property programmatically
to know the path of the DispatcherServlet please use DispatcherServletPath instead.
server.servlet.path 属性已移⾄spring.mvc.servlet.path。如果您通过编程的⽅式依赖该属性来了解DispatcherServlet的路径,请使⽤DispatcherServletPath。
@WebMvcTest and @WebFluxTest Security Configuration
⽤户配置现在⾃动包含在web⽚测试中。@WebMvcTest查WebSecurityConfigurer bean,⽽@WebFluxTest查ServerHttpSecurity bean。
Logging Refinements
Spring Framework 5.1在使⽤web应⽤程序(Spring MVC或Spring WebFlux)时重新访问了调试⽇志输出。如果你试图调试⼀个应⽤程序,并且你想恢复Spring Boot 2.0风格的⽇志记录,你应该在application.properties中添加以下内容:
logging.level.web=debug
您可能还想设置spring.http.log-request-details为true,记录实际请求的详细信息。默认情况下,此属性为false,因为它可能暴露敏感信息。Narayana JTA Support
为了⽀持与Narayana版本更加⼀致的官⽅⽀持,Narayana的⽀持已经被删除。如果你使⽤的是spring-boot-starter-jta-narayana,新的坐标如下:
me.snowdrop    narayana-spring-boot-starter    2.0.1
请参考 the documentation 以了解更多细节。
ActiveMQ Pooling
If you were using activemq-pool, support has been removed in this release in favor of pooled-jms that offers the same features while being JMS 2.0 compliant. You can update your build as follows:
如果您正在使⽤activemq-pool,那么在这个版本中已经删除了对pooled-jms的⽀持,pooled-jms提供了相同的特性,同时兼容JMS 2.0。你可以更新你的构建如下:
HttpPutFormContentFilter
HttpPutFormContentFilter has been deprecated in favor of FormContentFilter. As a result
the spring.mvc.abled property is no longer defined. If you were using this feature, please update
to spring.mvc.abled.
HttpPutFormContentFilter已经被弃⽤,取⽽代之的是FormContentFilter。 spring.mvc.abled 结果属性不在被定义。如果你正在使⽤这个特性,请更新到spring.mvc.abled。
springboot结构OAuth2 Client Configuration
The structure of the spring.security.istration has been reworked in a single tree rather than having
an authorizationcode and clientcredentials sub namespace.
spring.security.istration 的结构已经在在单个树中重新注册,⽽不是使⽤authorizationcode和clientcredentials⼦名称空间。
Micrometer 'all' SLA Handling
InfluxDB HttpClient Customization
在前⾯,声明OkHttpClient.Builder bean⾜以定制InfluxDB使⽤的客户端。要确保隔离此类⾃定义,请定义⼀个InfluxDbOkHttpClientBuilderProvider bean。
Maven Plugin
finalName属性不再是可定制的,以与标准Maven插件的⾏为保持⼀致。
如果您正在定制repackage⽬标,那么主执⾏现在有⼀个必须指定的repackage id,参考the updated sample.。
Spring Version POM Property
在spring-boot-dependencies POM中定义的spring.version属性已被重命名。要覆盖Spring Framework版本,现在应该使⽤ spring-framework.version属性。除⾮绝对必要,我们通常建议您坚持使⽤托管框架版本。
Removal of 'spring.provides' Files
starter 可以声明META-INF/spring.provides,以便IDE能够出它所提供的依赖项。扫描starter POM以寻它声明的直接依赖项应该⾜以作为⼀种指⽰。如果您是第三⽅启动器的负责⼈,并且声明了这个⽂件,那么可以删除它。
Thymeleaf Spring Security Extras
Thymeleaf的Spring Security Extras模块的依赖管理和⾃动配置已经从 thymeleaf-extras-springsecurity4 切换到 thymeleaf-extras-springsecurity5。如果您正在使⽤模块,则应该更新您的l或adle依赖thymleaf -extras-springsecurity5。
Json Simple
不再提供json-simple的依赖项管理,使⽤它的JsonParser实现也已删除。
Jersey 1
Jersey 1 不再⽀持。请升级到 Jersey 2.
Hibernate EhCache Support
如果你使⽤hibernate-ehcache来使⽤EhCache 2作为Hibernate的⼆级缓存提供商,它在Hibernate 5.3中已经弃⽤。
Endpoint ID names
如果您已经开发了⾃⼰的执⾏器@Endpoint bean,那么您应该确保它们遵循Spring Boot 2.1中引⼊的更严格的命名规则。具体来说,IDs应该是只包含字母数字的,并且必须以字母开头(有关完整细节,请参阅EndpointId类⽂档)。
如果你⽤ - or . 字符 Spring Boot 2.1将记录⼀个警告并要求您迁移到正确的格式。
Lombok
Spring Boot 2.1已经升级到Lombok 从1.16.x 到 1.18.x。在1.18中,默认情况下Lombok将不再⽣成私有的、⽆参数的构造函数。
在 fig configuration file 中,可以通过设置 aPrivate=true 启动它。有关Lombok更改的更多信息,请参阅其更改⽇志-changelog。
Java Persistence API dependency
作为升级到Hibernate 5.3的⼀部分,托管Java持久化API依赖关系已经从org.hibernate.javax.persistence:hibernate-jpa-2.1-api更改
为 javax.persistence:javax.persistence-api。如果您正在使⽤spring-boot-starter-data-jpa或通过Hibernate传递依赖于API,那么您将不受此更改的影响。
JpaProperties
特定于hibernate的属性已经从JpaProperties移到⼀个名为HibernateProperties的单独类中。如果你正在使⽤JpaProperties. getHibernateProperties(HibernateSettings),你现在应该同时注⼊HibernateProperties和JpaProperties来确定属性:
Consistent max HTTP header size across all embedded web servers
The default max HTTP header size is now consistent across the four supported embedded web servers (Jetty, Netty, Tomcat, and Undertow) and is 8KB. The size can be customized using the server.max-http-header-size property.
默认的最⼤HTTP报头⼤⼩现在在四个⽀持的嵌⼊式web服务器(Jetty、Netty、Tomcat和Undertow)中是⼀致的,是8KB。可以使⽤server.max-http-header-size属性。
New and Noteworthy
Tip Check the configuration changelog 查看配置更改的完整概述。
Third-party Library Upgrades
Spring Boot 2.1构建于Spring Framework 5.1之上,并且需要Spring Framework 5.1。
我们已经尽可能地升级到其他第三⽅jar的最新稳定版本。这个版本中⼀些值得注意的依赖升级包括:
Tomcat 9
Undertow 2
Hibernate 5.3
JUnit 5.2
Micrometer 1.1
Java 11 Support
Spring Boot 2.1仍然与Java 8兼容,但现在也⽀持Java 11。我们配置了持续集成,以针对最新的Java 11版本构建和测试Spring Boot。
DataSize Support
如果⼀个属性需要以字节或类似的⽅便单位表⽰⼤⼩,它可以公开org.springframework.util.unit.DataSize属性。与我们在Spring Boot 2.0中引⼊的持续时间⽀持类似,数据⼤⼩⽀持⼀种简单的格式(即10MB for 10 兆字节)和元数据⽀持。所有相关配置属性都已更新,以使⽤新类型。
Context ApplicationConversionService Support
ApplicationConversionService 现在默认注册到SpringApplication创建的环境和BeanFactory中。这允许你直接使⽤应⽤程序转换器和Spring Framework 的核⼼项⽬,⽐如@Value注释:
Profile Expression
Profile matching has been improved to support an expression format. For instance production & (us-east | eu-
central) indicates a match if the production profile is active and either the us-eas t o r eu-central profiles are active.
配置⽂件匹配已得到改进,以⽀持⼀种表达式格式- an expression format。例如,production & (us-east | eu-central) 表⽰匹配,如果production 配置⽂件是激活的,并且 us-east 和  eu-central 配置⽂件是激活的。
配置⽂件表达式可以使⽤如下:
Enable componets using @Profile
Load multi-profile YAML Documents
Enable Logback configuration using <springProfile>
Task Execution
Spring Boot现在为ThreadPoolTaskExecutor提供⾃动配置。如果你正在使⽤@EnableAsync,你的⾃定义TaskExecutor可以被删除,以便从ution namespace中进⾏定制。使⽤TaskExecutorBuilder可以轻松创建⾃定义ThreadPoolTaskExecutor。
Task Scheduling
与新的任务执⾏⽀持类似,当指定@EnableScheduling时,Spring Boot⾃动配置ThreadPoolTaskScheduler。任务调度程序可以使⽤spring.task.scheduling 进⾏定制。默认情况下,TaskSchedulerBuilder也是可⽤的。
Logging Groups
Logger groups can be defined to allow related loggers to be configured in one go. For example, you could declare
a tomcat group that allows you to configure org.apache.catalina, and at loggers with a single key:
可以定义记录器组,以允许⼀次性配置相关的记录器。例如,您可以声明⼀个允许配置具有单独key的org.apache.catalina, 和at ⽇志记录器的tomcat组。
⽅便的web和sql组是开箱即⽤的。See the reference guide for details.
Maven Plugin
指定参数已经改进为系统属性(system properties)和环境变量(environment variables)的专⽤选项。也可以重新打包并替换分类⼯件,查看分类器属性的更新⽂档-the updated documentation。
Bootstrap mode for JPA setup

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。