内容简介:Spring官方的Spring Boot 2变动指南,主要是帮助您将应用程序迁移到Spring Boot 2.0,变化部分还是很多很细节的,摘录主要点如下:Spring Boot 2.0需要Java 8或更高版本。不再支持Java 6和7。它还需要Spring Framework 5.0,许多配置属性被重新命名/删除,开发者需要更新他们的application.properties/ application.yml相应。为了帮助您,Spring Boot提供了一个新spring-boot-properti
Spring官方的Spring Boot 2变动指南,主要是帮助您将应用程序迁移到Spring Boot 2.0,变化部分还是很多很细节的,摘录主要点如下:
Spring Boot 2.0需要 Java 8或更高版本。不再支持Java 6和7。它还需要Spring Framework 5.0,许多配置属性被重新命名/删除,开发者需要更新他们的application.properties/ application.yml相应。为了帮助您,Spring Boot提供了一个新spring-boot-properties-migrator模块。一旦作为项目的依赖项添加,这不仅会在启动时分析应用程序的环境和打印诊断,还会在运行时为您临时迁移属性。这是您在应用程序迁移期间必须具备的功能:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
<p>
Spring Boot现在默认使用CGLIB代理,包括AOP支持。如果需要基于接口的代理,则需要设置spring.aop.proxy-target-class为false
添加了一个新活动ApplicationStartedEvent。 ApplicationStartedEvent在刷新上下文之后但在调用任何应用程序和命令行运行程序之前发送。 ApplicationReadyEvent在调用任何应用程序和命令行运行程序后发送。它表示应用程序已准备好为请求提供服务。
Spring Boot 2使用Thymeleaf 3
在2.0中,我们将Jackson配置默认设置为将JSR-310日期写为ISO-8601字符串。如果要返回先前的行为,可以添加spring.jackson.serialization.write-dates-as-timestamps=true到配置中
Spring Boot 2大大简化了默认的安全配置,使添加自定义安全性变得简单。
安全自动配置不再公开选项,并尽可能使用Spring Security默认值。
Spring Boot 2 通过Spring Security 5 提供OAuth 2.0客户端支持
Actuator不再有单独的安全自动配置(management.security.*属性消失)
Spring Data Kay 重命名了许多CRUD存储库方法。调用重命名方法的应用程序代码必须更新。为了简化迁移,您可能需要考虑使用自定义CrudRepository子接口来声明不推荐使用旧名称的默认方法,并委托给等效的新命名方法。
默认连接池已从Tomcat切换到HikariCP.
DataSource现在,只对嵌入式数据源启用基本初始化,并在使用生产数据库时立即关闭。新的spring.datasource.initialization-mode(替换spring.datasource.initialize)提供更多的控制。
仅当未使用Liquibase或Flyway等架构管理器时,该spring.jpa.hibernate.ddl-auto属性create-drop才会默认使用嵌入式数据库。一旦检测到架构管理器,默认值就会更改为none.
Elasticsearch已升级到5.4+
不再可以自动配置常规HazelcastInstance和专用HazelcastInstance缓存。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Web Development Recipes
Brian P. Hogan、Chris Warren、Mike Weber、Chris Johnson、Aaron Godin / Pragmatic Bookshelf / 2012-1-22 / USD 35.00
You'll see a full spectrum of cutting-edge web development techniques, from UI and eye candy recipes to solutions for data analysis, testing, and web hosting. Make buttons and content stand out with s......一起来看看 《Web Development Recipes》 这本书的介绍吧!
RGB HSV 转换
RGB HSV 互转工具
RGB CMYK 转换工具
RGB CMYK 互转工具