Search code examples
neo4jspring-data-neo4jneo4j-ogm

spring-boot-starter-data-neo4j not loading the OGM core annotations


Following is the pom xml file which i am using. Problem here is it doesn't include @NodeEntity, @RelatedTo annotations and rather it has @Node @Relationship annotations. Later one is I guess the new set which is also used with SDN reactive. I want to understand is it that with newer version the OGM annotations are not bundled or am i missing something here?

Pom xml

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.demo</groupId>
    <artifactId>be</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo-be</name>
    <description>demo backend project</description>

    <properties>
        <java.version>11</java.version>
    </properties>

    <dependencies>

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

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

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


        <!---google client libs-->
        <!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.31.1</version>
        </dependency>


    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Solution

  • You are correct: the latest SDN does not depend on Neo4j anymore. It comes with its own annotations for mapping. There is a migration section in the documentation that is intended to help you with the move towards SDN 6. https://docs.spring.io/spring-data/neo4j/docs/current/reference/html/#Migrating