spring-data-neo4j

Map Spring Data Neo4j domain models to Neo4j graphs with Cypher queries.

322|37|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-data-neo4j
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spring-data-neo4j
Source: https://github.com/giuseppe-trisciuoglio/developer-kit/tree/main/skills/spring-boot/spring-data-neo4j
Command: npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-data-neo4j

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill offers patterns for modeling graphs, mapping nodes and relationships, custom Cypher queries, and both imperative and reactive Neo4j operations within Spring Boot.

Core Features & Use Cases

  • Node and relationship mapping with @Node, @Relationship
  • Neo4j repositories and @Query usage
  • Reactive vs imperative operation guidance
  • Graph traversal and pattern modeling

Quick Start

Set up a simple graph with two node types and a relationship, then query with a custom @Query.

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 domain models to Neo4j graphs using Spring Data?

Spring Data Neo4j maps domain models to Neo4j graphs through @Node and @Relationship annotations on entity classes. Define node entities with @Node, mark identifiers with @Id and @GeneratedValue, use @Property for fields, and @Relationship to connect entities. Configure Spring Boot dependencies and repositories to enable automatic persistence and querying against your graph database.

Can I write custom Cypher queries in Spring Boot with Neo4j?

Yes, use @Query annotations on repository methods to compose custom Cypher queries in Spring Data Neo4j. Write Cypher directly in the annotation value, bind method parameters to query variables, and return typed results. This approach lets you optimize graph traversal patterns and access Neo4j's full query capability within Spring Boot repositories.

What's the difference between reactive and imperative Neo4j operations in Spring?

Imperative operations block and return results directly; reactive operations return Publisher types (Mono, Flux) for non-blocking, async execution. Spring Data Neo4j supports both through separate repository interfaces and drivers. Choose imperative for standard request-response flows and reactive for high-concurrency, event-driven applications.

How do I test Neo4j graph models in a Spring Boot application?

Use embedded Neo4j testing configurations within Spring Boot test classes to instantiate an in-memory database without external dependencies. Configure test repositories, seed graph data with @Query or direct API calls, and validate node and relationship structure. This approach supports cross-version compatibility checks and common graph scenarios.

Do I need specific annotations for Neo4j relationships and properties in Spring?

Yes, @Relationship decorates entity fields to define graph edges and cardinality. @Property marks individual fields for storage. @GeneratedValue auto-increments Neo4j IDs. These annotations configure the mapping layer so Spring Data Neo4j automatically translates your domain model into graph structure during persistence and retrieval.