Search code examples
spring-data-neo4jneo4j-ogm

@CompositeProperty annotation for reactive neo4j implementation


I want to experiment on neo4j reactive implementation from an existing spring-boot project using neo4j. while migrating to Reactive neo4j implementation, I'm missing the CompositeProperty for the dynamic properties. Is @CompositeProperty supported? or would it be in the future implementation?

Please suggest how to resolve this.

I tried with following dependency.

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

Solution

  • You should not use Spring Data Neo4j R/X anymore. It was a WIP project that eventually finds its destination as the successor of Spring Data Neo4j 5.x (and before). With a recent Spring Boot release (starting with 2.4), you will get the completely rewritten Spring Data Neo4j if you add the Spring Data Neo4j Boot starter to your dependencies:

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

    And yes, it has @CompositeProperties (https://docs.spring.io/spring-data/neo4j/docs/current/reference/html/#custom.conversions.composite-properties)

    @Node
    public class Entity {
        // id etc.
    
        @CompositeProperty
        private Map<String, String> additionalFields = new HashMap<>();
    }
    

    It supports prefix, converter, and even converterRef(erences) to bean instances.