Engineering
Releases
News and Events

Spring Data Lovelace RC1 available

On behalf of the Spring Data team, it is my pleasure to announce the availability of the Lovelace RC1 release. The first release candidate ships on top of the just-released Spring Framework 5.1 RC1 and in preparation of the upcoming Spring Boot 2.1 M1 release.

This release candidate ships with 194 tickets fixed and contains the following notable changes:

  • Support for immutable objects.
  • Upgrade of Querydsl for MongoDB to use the Document API, letting you publish lifecycle events and participation in managed transactions.
  • Reactive Slice query support for Apache Cassandra.
  • Kotlin extension for Apache Cassandra.
  • Reactive SCAN support for Redis.

Immutable object support allows the use of truly immutable objects with Spring Data without interference caused by reflective access. Previously, immutable objects could experience a change if those were subject to ID generation, auditing, or optimistic locking. These kinds of operations mutated entities in place, which resulted in changes of actually immutable objects.

As of this release, Immutable object support ensures that immutable entities are not changed. insert and save methods return a new instance of the object that is associated with a mutation, such as a generated ID. This change requires your code to recompile as method return types have changed. Immutable object support requires a corresponding data model within the application code:

  • Usage of Kotlin data classes to leverage the .copy(…) method
  • Value objects exposing with... methods

with... methods create a new instance of an object that carries all previous property values and has a changed value of the with… property, as the following example shows:

class Person
{
  private final @Id String id;
  private final String name;
  
  private Person(String id, String name) {
    // …
  }
  
  // …
  
  Person withId(String id) {
   return new Person(id, this.name);
  }
}

Lombok users can use @Value and @Wither annotations to follow the with... pattern.

Immutable object support is available for the Spring Data MongoDB, Apache Cassandra, Couchbase, ElasticSearch, Redis, KeyValue, Neo4j (Auditing), and Spring Data REST modules. Immutable object support for JPA is not possible, as the mapping layer resides inside JPA implementations. Entirely immutable objects with bi-directional relations are not possible for Neo4j. Immutable object support for JDBC follows along with Lovelace RC2.

We are aiming for a Lovelace RC2 release for the end of August and a GA release mid-September, just in time for this years’ SpringOne Platform in Washington DC.

Here are the links to all the details, documentation and changelogs:

comments powered by Disqus