Spring Boot 2.0 was finally released on May 1, 2018, and my blog has been upgraded to it from Spring Boot 1.5.9.
Spring Boot 2.0 is a major update of 17 months' work. It breaks some configurations due to refactoring and dependency updates along with it.
Package removable/rename:
spring-boot-starter-mobile
starter is removed.spring-session
should be replaced byspring-session-data-redis
.
Gradle plugin updates:
- Dependency management plugin is no longer automatically applied, and should be explicitly enabled.
- The
bootRepackage
task is replaced bybootJar
, and as a resultjar
task is no longer not invoked when building executable jars. This breaks configuration forjar
task.
Dependency updates:
- Hibernate validator from 5.3.6 to 6.0.7:
org.hibernate.validator.constraints.NotEmpty
is deprecated andjavax.validation.constraints.NotEmpty
should be used. - Flyway: Spring Boot's default
flyway.table
has been changed fromschema_version
toflyway_schema_history
. spring-data-commons
from 1.13 to 2.0: Configuration for 1-based pagination has to be changed.
Refactoring:
AbstractErrorController
,ErrorViewResolver
are moved from packageorg.springframework.boot.autoconfigure.web
toorg.springframework.boot.autoconfigure.web.servlet.error
.FreeMarkerAutoConfiguration.FreeMarkerWebConfiguration
is replaced by a package-private class, breaking the configuration that extends the class.
Configuation:
management.security.*
is gone, and current solution is to configure web security programatically, making it harder to configure different strategies for different profiles.- All actuator endpoints are moved to
/actuator
by default.
One problem that I found when upgrading is that not all changes are listed in Spring Boot 2.0 release note and migration guide. You have to build the project to check errors and warning, and solve them one by one. Sometimes you have to check its source code for an alternative solution to broken configuration.