Spring Data Neo4j RX 1.0 Is Now Available


Over the last year, we developed a new version of Spring Data Neo4j here at Neo4j, and we are proud to announce its general availability: Spring Data Neo4j RX 1.0 (or short SDN/RX).

Learn about Spring Data Neo4j RX.


Spring All the Way


Spring Data Neo4j RX is not dependent on any Object Graph Mapper library, but brings all mapping capabilities built-in. Choosing to go full-on Spring makes it profit from Spring Data’s ecosystem, especially the provided mapping and conversion support.

We are listening to our very helpful community and colleagues who are working close with customers and give us their feedback. As a result, we not only provide a Spring Boot starter to get you started quickly and support you along the way with SDN/RX, but we’ve also created separate Spring Boot starters for the 1.7 and 4.0 series of the Neo4j Java Driver.

Even if you decide not to use a mapping framework, you can configure the driver and work with an instance created for you within a Spring Boot application.

Immutable and Reactive Support


Using immutable entities throughout the application is a very important feature, and we want to give you the best experience. It doesn’t matter if you are using manually constructed immutable classes, Lombok’s @Data annotation, Kotlin data classes or Java 14+ experimental records. Spring Data Neo4j RX maps your data to these classes and respects their immutable nature.

Another important cornerstone of Spring Data Neo4j RX is to support the reactive programming model. This means you can now benefit from Neo4j 4.0 reactive data access and take control over the stream of data you’re querying for. Of course, we still provide support on the same level for imperative programming approaches as well.

Connectivity


It has been an intentional decision to base all connections to Neo4j on the superb Java Driver. This gives us not only a stable communication but also enables us to make use of its type system reflecting the database’s one.

The use of the latest driver also ensures that you can always connect to the latest versions of the database and Aura instances with all its features.

Choose Your Level of Abstraction


The best advice is to access your domain by using a repository for the aggregate root as described in Domain Driven Design. But we know there are cases that require you to have more control over the querying and mapping process. This is the reason why the Neo4jTemplate and the Neo4jClient got introduced.

The first one is aware of all the entities and relationships you have defined. It will take care of mapping the results from your custom query to those entities.

The second one does not need any information about your domain but requires you to additionally provide a mapping function to create instances of your POJO from the result of a given Cypher query.

CypherDSL


In the early days of Spring Data Neo4j RX, it was considered an internal API only. But, again, we listened to our community asking for a public surface and more features of the DSL. As a result, we made most of the parts now public available within the SDN/RX framework.

We are still in a phase where this API might change, but we did not want to make you wait to try it out. This is the reason why we exposed it as an experimental API in the 1.0 release.

Where to Start


The easiest way to set up a new project is to go to start.spring.io and create a new Spring Boot application. All that is required after downloading your application is to add the Spring Data Neo4j RX starter dependency to your project.

<dependency>  
  <groupId>org.neo4j.springframework.data</groupId>  
  <artifactId>spring-data-neo4j-rx-spring-boot-starter</artifactId>  
  <version>1.0.0</version>  
</dependency>	

Model your domain according to the documentation and create a suitable repository definition to access your data. There are also some useful examples for imperative and reactive applications.

What the Future Will Look Like


Spring Data Neo4j RX should be seen as the replacement of the current SDN/RX. In a future version of Spring Data it will get picked up and the current version of Spring Data Neo4j will be put into maintenance mode.

Of course, we will still provide bug fixes and apply security fixes to the already existing versions out there that have not reached their EOL.


Further Reading


We already have written up some more detailed posts:

The project’s documentation can be found here and there is also a developer guide for Spring Data Neo4j RX containing a walk-through tutorial.


Want to take your Neo4j skills up a notch? Take our online training class, Neo4j in Production, and learn how to scale the world’s leading graph database to unprecedented levels.

Take the Class