Migration guide: platform 5.0.x to 5.1.x

Platform 5.1.0 is bound to Across 5.1.0. Upgrading to Platform 5.1.0 usually requires you to make some configuration and code changes to your applications.

Most of these changes are required due to deprecations/changes in Spring Boot 2.2 and Spring Boot 2.3

If you are coming from Platform 5.0.x, make sure you read and follow the release for:

This guide is not a full overview of all new features and changes in Across or any of its modules. It mainly focuses on upgrade related changes: usually breaking changes or new features that impact application/module configuration.

Across Platform

JUnit5

JUnit5 is now a first class dependency when you pull in across-test. You can still use JUnit4 in your project (or junit-jupiter-vintage) but it’s recommend to start switching towards JUnit5.

Across Core

Deprecated Spring Boot properties

  • Some Spring Boot properties have been removed in Spring Boot 2.2 and 2.3, if you still use them you should migrate them

    • spring.http.encoding.* → `server.servlet.encoding.*

    • spring.http.log-request-detailsspring.mvc.log-request-details (Spring MVC) or `spring.codec.log-request-details (Spring WebFlux)

    • spring.http.converters.preferred-json-mapperspring.mvc.converters.preferred-json-mapper

    • spring.http.multipart.enabledspring.servlet.multipart.enabled

Deprecated/Bumped library versions

Some deprecated/outdated libraries have been removed from across-core-dependencies. You can still use them but you will have to include them manually in your project.

Removed:

  • cglib:cglib:3.1

Updated:

  • commons-collections4:4.4

  • mysql:mysql-connector-java:8.0.21 (now follows spring-boot-dependencies)

HttpHiddenMethodFilter

If you are using the HttpHiddenMethodFilter in your project, you must manually reinclude it. It has been removed from Spring Boot 2.3 as a default inclusion. See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes)

Empty @RestController logic change

Since Spring Framework 5.2 a change has been made in how @RestController() (without explicit mapping) behaves.

The following example might not behave like before:

@RestController
class PersonController {

    @GetMapping
    @ResponseBody
    public String getPerson() {
       return "Joe";
    }

}

Before Spring Framework 5.2 an empty @RestController would automatically match **.This has been change this Spring Framework 5.2 because it was behaving as default @RequestMapping() endpoint.The change was done in https://github.com/spring-projects/spring-framework/issues/22543 and is a breaking change.

You should scan occurences of empty @RestController annotations and explicitly match them with @RequestMapping("**").This is a common scenario if you are using CustomRequestMapping or RequestCondition

The above controller should look like:

@RestController
@RequestMapping("**")
class PersonController {

    @GetMapping
    @ResponseBody
    public String getPerson() {
        return "Joe";
    }

}

Across Autoconfigure

Hateos classes have been renamed

If you use hateos, this version has received an upgrade to 1.x and most classes like ResourceSupport, Resource have been renamed.

The summary is:

  • ResourceSupport is now RepresentationModel

  • Resource is now EntityModel

  • Resources is now CollectionModel

  • PagedResources is now PagedModel

Changes in Cassandra

If you use cassandra-unit, update the version from 3.3.x.x to 4.3.1.0.

Cassandra has also switched to a new driver-sync dependency underneath.

This means you might have to change com.datastax.driver.core.Session to com.datastax.oss.driver.api.core.CqlSession.

Elasticsearch

Switch to the Rest client if possible, the native elasticsearch template is being deprecated.

Spring Boot Admin

Spring Boot Admin has been updated to version 2.3.0 to align with Spring Boot. If you are using a hardcoded version, please make sure you update it.

GraphQL

GrapQL has been updated to more recent versions

  • com.graphql-java-kickstart:graphql-spring-boot-starter:8.0.0

  • com.graphql-java-kickstart:graphql-java-tools:6.2.0

These dependencies have moved to a new package: graphql.kickstart.tools instead of com.oembedler.moon.graphql. The older dependencies may still work if you hardcode them, but it is recommended to switch to the new versions.

Across Hibernate Module

Sort.by and PageRequest.of changes

Spring Data Commons has deprecated the constructor calls for Sort and PageRequest.

You should use the static methods PageRequest.of() and `Sort.by() instead.

JPA repositories Bootstrap Mode

You can now use the BootstrapMode on @EnableAcrossJpaRepositories to use DEFERRED or LAZY repositories.

Only JPA repositories scanned by the annotation will be lazy or deferred.

You can also use the Spring Boot configuration property spring.data.jpa.repositories.bootstrap-mode to set this on all your repositories.

BasicRevisionBasedRepository

Following the deprecation of Session.createCriteria(), BasicRevisionBasedRepository has been deprecated.

It has been replaced by BasicRevisionBasedJpaRepository which uses JPA specifications.

Spring Security Module

If you are using SwitchUserGrantedAuthority in your code (unit test), the Authentication parameter cannot be null anymore.