Spring Boot change
Minimum Java 8
Releasing a new major release gives the Spring team the opportunity to recompile the Java 8-based code base and use its new features. As a result, Spring Boot 2.0 requires Java 8 or higher, and it no longer supports Java 6 and Java 7 because they have reached the end of their lives.
Support Java 9
Spring Boot 2 fully supports Java 9. If you want to run Spring Boot applications with Java 9, see Spring Boot with Java 9.
Spring Framework 5.0
Spring Framework 5.0 is required to build Spring Boot 2.0. Although Spring 5 has been widely available since September 2017, most projects will likely start adopting Spring Boot 2.0 when it is officially released. Spring 5 introduces some nice improvements, and one of the most notable new features is Reactive Stack.
The embedded Servlet container
-
Jetty: Minimum version 9.4
-
Tomcat: The latest version is 8.5
The TLS configuration
You can use server.ssl.*
Property configures SSL for your WebFlux application. Tomcat, Jetty, Undertow, and Reactor Netty all support this configuration.
Support HTTP / 2
Spring Boot can also enable your MVC or WebFlux application to use HTTP/2 by setting server.http2.enabled. It supports Tomcat, Undertow, and Jetty. This depends on the server you choose, the JDK, and other criteria.
-
Spring Boot configures HTTP2
build
-
Maven: Maven projects are compiled using the -parameters compiler flag by default.
-
Gradle: Spring Boot requires the Gradle 4.x. Spring Boot Gradle plug-in, which has been largely rewritten to implement many major improvements. You can read more about the plug-in’s capabilities in its references and API documentation.
Configuration Gradle BootRun
BootRun tasks provide properties for configuring application parameters (ARGS) and JVM parameters (JVMarGs), with more advanced configurations available through ExecSpec. See the Gradle plug-in documentation for more details. Based on user feedback, the BootRun task once again becomes a subclass of Gradle’s JavaExec task. It can be configured just like any other JavaExec task.
JDBC/ORM changes
Default database connection pool
The default connection pool has changed from Tomcat to HikariCP. If you are using Hikari in a tomcat-JDBC environment, you can remove spring.datasource. Type. Again, if you want to continue using The Tomcat connection pool, simply add the following to the configuration: Database migration Liquibase and Flyway configuration keys are moved to spring namespace, The spring respectively. The liquibase and spring. FlywayFlyway/liquibase flexible configuration if only provide custom url or user, the automatic configuration will reuse standard data source properties rather than ignore them. This allows you to create custom data sources for migration purposes using only the information you need.
Check for data source initialization
If Flyway or Liquibase are managing data sources and you are using an embedded database, Spring Boot 2 will automatically turn off Hibernate’s automatic DDL feature.
Database initializer
Spring Batch, Spring Integration, Spring Session, Quartz database initialization occurs by default only when using an embedded database. The enable property has been replaced with a more expressive enumeration. For example, if you want to always perform Spring Batch initialization, you can set that database initialization data source initialization is only enabled for embedded data sources and is turned off whenever you use a production database. In addition, the new spring. The datasource. Initialization – mode (to replace the spring. The datasource. The initialize) provides more control. The data source metrics detection tool is responsible for viewing all available data sources and publishing metrics (minimum, maximum, and usage) for each data source. Configurable JPA mapping resources can customize the JdbcTemplate automatically configured by Spring Boot via spring.jdbc.template. In addition, the automatic configuration of NamedParameterJdbcTemplate behind the scenes to reuse the JdbcTemplate.
Hibernate
The minimum supported version of Hibernate is 5.2. Read the Hibernate 5.2 Migration Guide to learn how to upgrade.
Support for custom Hibernate naming strategies
For advanced scenarios, you can define ImplicitNamingStrategy or PhysicalNamingStrategy to be used as a regular Bean in context.
Hibernate Attribute Customization
Through the exposed HibernatePropertiesCustomizer, can be used more carefully customized Hibernate properties.
NOSQL
CassandraThe spring.data.cassandra exposes pooling options.
Responsive Couchbase support
Spring Data Reactive Repositories is available for Couchbase and is easily available via Spring-boot-starter-data-Couchbase-Reactive.
InfluxDB
If the InfluxDB Java client and spring.dolphin. url are set, the InfluxDB client is automatically configured. Support for credentials is also available. Health endpoints can monitor the InfluxDB server.
Redis cache configuration
You can expose RedisCacheConfiguration to control RedisCacheManager. A new annotation @dataredistest has also been introduced.
Elasticsearch
Spring Boot 2 now requires Elasticsearch 5.4. Elastic’s announcement that Embedded Elasticsearch is no longer supported, NodeClient autoconfiguration has been removed. Through a TransportClient use spring. Data. Elasticsearch. Cluster – nodesto automatic configuration of one or more connected to the node address.
Mongo client custom
Can define a type of MongoClientSettingsBuilderCustomizer bean to haute couture was applied to Spring the Boot automatically configure the mongo client.
test
Mockito 1.x
Mockito 1.x no longer supports @MockBean and @SpyBean. If you do not use spring-boot-starter-test to manage your dependencies, you should mockito2.x.
Kotlin Extensions for TestRestTemplate
The Kotlin RestTemplate extension is also available for TestRestTemplate to make the developer experience consistent.
Test Improvements Converter and GenericConverter are automatically scanned using @webMvctest and @webFluxtest.
Recommend an exchange learning group: 478030634, which will share some veteran architects recorded video: Spring, MyBatis, Netty source code analysis, high concurrency, high performance, distributed, microservice architecture principle, JVM performance optimization these become architects necessary knowledge system. You can also receive free learning resources, which have benefited a lot at present: