A personal project of mine using Spring 1.5.12-RELEASE and I figured I’d bite the bullet & upgrade. Before you embark on this upgrade, review the release notes, the configuration change log, a migration guide, and other articles on the subject.
These are changes that affected my project:
- Context path updates: server.contextPath is now server.servlet.context-path
- Actuator updates: Previously it was /app-context/health, it’s now /app-context/actuator/health. Note: to restore previous behavior, set
management.endpoints.web.base-path=/
- Server: org.springframework.boot.web.support.SpringBootServletInitializer relocated to org.springframework.boot.web.servlet.support.SpringBootServletInitializer.
- Spring repositories:
- findOne no longer takes the id (e.g. long) but the actual entity. I replaced this with with findbyId (a built-in convenience method to the repository)
- I previously could pass a List<T> to the save method. You are now required to use saveAll which is more appropriate
- My JpaRepository classes previously returned an Iterable for methods like findAll. This method now returns a Collection (e.g. List<T>) of entities (additional info here).
- Database:
- Connection pooling – Hikari is now the default connection pooling mechanism. Avoid using DataSourceBuilder’s automatic configuration with 2.x (see issue and additional documentation on configuring your datasource).
- Postgresql – I was previously on version 9.0-801.jdbc4 and I switched to the latest to resolve the following error ‘ PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.’
- Testing:
- Mockito – *.runners.MockitoJUnitRunner is now in *.junit.MockitoJUnitRunner