spring-data-neo4j

Configure Spring Data Neo4j repositories, entities, and Cypher queries.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill spring-data-neo4j-rizaldiem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-data-neo4j
Source: https://github.com/rizaldiem/digital-invitation-web_V2/tree/main/.windsurf/skills/spring-data-neo4j
Command: npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill spring-data-neo4j-rizaldiem

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Provides clear patterns and actionable guidance to integrate Neo4j graph databases with Spring applications, reducing boilerplate and preventing common modeling and query mistakes when working with nodes, relationships, and repositories.

Core Features & Use Cases

  • Setup & Configuration: How to add the dependency, configure spring.neo4j connection properties, and set the Cypher-DSL dialect.
  • Entity & Relationship Mapping: Best practices for @Node, @Id strategies (business key vs generated), @Relationship, @Property and immutable entities.
  • Repository Patterns: Using Neo4jRepository and ReactiveNeo4jRepository, query derivation, and custom @Query Cypher usage.
  • Reactive vs Imperative: Guidance on choosing and isolating reactive and blocking approaches and their runtime requirements.
  • Testing & Tooling: How to test repositories with Neo4j Harness, use @DataNeo4jTest, and provide fixtures for integration tests.
  • Real-world Use Case: Model a movie database or social network where entities, relationship properties, custom queries, and projections are required for efficient reads and writes.

Quick Start

Add the spring-boot-starter-data-neo4j dependency to your Spring Boot project and configure spring.neo4j.uri, username, and password to connect and begin defining @Node entities and repositories.

Frequently Asked Questions about spring-data-neo4j

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map Neo4j nodes and relationships in a Spring Boot application?

To map Neo4j nodes and relationships in Spring Boot, define domain entities using the @Node annotation and connect them via @Relationship. This provides patterns for modeling graph data, including @Property mapping and @Id strategies for business keys or generated values, reducing boilerplate.

What is the difference between Neo4jRepository and ReactiveNeo4jRepository in Spring Data?

Neo4jRepository supports imperative blocking operations, while ReactiveNeo4jRepository handles non-blocking reactive data flows. Spring Data Neo4j provides guidance on isolating these approaches based on your application's runtime requirements for efficient graph database reads and writes.

How do I write custom Cypher queries in Spring Data Neo4j repositories?

You write custom Cypher queries in Spring Data Neo4j by annotating repository methods with @Query and providing the Cypher statement. This allows executing complex graph traversals alongside standard repository query derivation for retrieving nodes and relationships.

How do I configure spring.neo4j connection properties and set the Cypher-DSL dialect?

Configure your connection by setting spring.neo4j.uri, username, and password in your Spring Boot properties. You must also configure the Cypher-DSL dialect to ensure the framework generates and executes the correct graph query syntax for your environment.

How do I test Spring Data Neo4j repositories using Neo4j Harness?

Test Spring Data Neo4j repositories using the Neo4j Harness and the @DataNeo4jTest annotation. This setup provides fixtures for integration testing, allowing you to validate repository creation, entity mapping, and custom Cypher queries without requiring a standalone database.

Can I use immutable entities with Spring Data Neo4j for graph database modeling?

Yes, Spring Data Neo4j supports immutable entities for graph database modeling. By applying @Node, @Id, and @Property annotations to immutable classes, you can safely map graph data while preventing common modeling and query mistakes.