Spring Boot Latest Version
As of May 21st of 2021, The latest stable spring boot version is 2.5.0. Spring Boot 2.5.0 offers a variety of new fixes and dependency updates. Let’s check them out in detail.
Java and Spring Boot version Compatibility
Spring Boot 2.5.0 requires at least Java 8. It is also tested with java 16.
Important dependency version updates
Dependency | Version |
---|---|
Spring Framework | 5.3.7 |
Embedded Tomcat Server | 9.0.46 |
Hibernate | 5.4.31.Final |
HikariCP – Connection Pool | 4.0.3 |
What’s new in Spring Boot 2.5
Lets go through some noteworthy changes in Spring Boot version 2.5.0.
- Environment variable prefixes. By setting
application.setEnvironmentPrefix("myapp")
, you can use MYAPP_SERVER_PORT instead of SERVER_PORT. - All embedded servers now support HTTP2 out of the box. To enable this, set
server.http2.enabled=true
- Jetty 10 is available but can only work with Java 9. So the default version is still Jetty 9.
Things to consider while upgrading from version 2.4
Here are the things to consider while moving to spring boot 2.5.0.
- The breaking change in the latest spring boot version is on the datasource initialization. The new SQL initialization doesn’t detect embedded databases. This means, the
schema.sql
anddata.sql
will apply to the primary data source regardless of whether it is embedded or not.- To avoid this, you should set the
spring.sql.init.enabled
tofalse
. - Or, you could set the
spring.datasource.initialization-mode
toembedded
to simulate old behaviour.
- To avoid this, you should set the
- Also, data.sql will now run before hibernate initializes the schema. You should use
spring.jpa.defer-datasource-initialization
totrue
if you want to do it the other way. - The
spring.flyway.url
orspring.liquibase.url
now requires you to use additionalusername
andpassword
properties.
This is one of my favorite spring framework blogs, keep on the good work 💪