From 045d2f678d0e66e1fb1674e7bd20b54e42bd610b Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 13 Aug 2020 17:51:39 +0200 Subject: [PATCH] Document Spring Data Neo4j 6 support Closes gh-22652 --- .../src/docs/asciidoc/spring-boot-features.adoc | 10 ++++++---- .../test/autoconfigure/data/neo4j/DataNeo4jTest.java | 7 +++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index b1e12cd076..5d7f76bea6 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -4527,9 +4527,10 @@ Each will be called in order with the `ConfigBuilder` that is used to build the [[boot-features-spring-data-neo4j-repositories]] ==== Spring Data Neo4j Repositories Spring Data includes repository support for Neo4j. +For complete details of Spring Data Neo4j, refer to the {spring-data-neo4j-docs}[reference documentation]. Spring Data Neo4j shares the common infrastructure with Spring Data JPA as many other Spring Data modules do. -You could take the JPA example from earlier and define `City` as Neo4j OGM `@NodeEntity` rather than JPA `@Entity` and the repository abstraction works in the same way, as shown in the following example: +You could take the JPA example from earlier and define `City` as Spring Data Neo4j `@Node` rather than JPA `@Entity` and the repository abstraction works in the same way, as shown in the following example: [source,java,indent=0] ---- @@ -4547,9 +4548,10 @@ You could take the JPA example from earlier and define `City` as Neo4j OGM `@Nod ---- The `spring-boot-starter-data-neo4j` "`Starter`" enables the repository support as well as transaction management. -You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively on a `@Configuration`-bean. +Spring Boot supports both classic and reactive Neo4j repositories, using the `Neo4jTemplate` or `ReactiveNeo4jTemplate` beans. +When Project Reactor is available on the classpath, the reactive style is also auto-configured. -TIP: For complete details of Spring Data Neo4j, including its object mapping technologies, refer to the {spring-data-neo4j-docs}[reference documentation]. +You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively on a `@Configuration`-bean. @@ -7152,7 +7154,7 @@ If, however, you prefer to run tests against a real MongoDB server, you should e [[boot-features-testing-spring-boot-applications-testing-autoconfigured-neo4j-test]] ==== Auto-configured Data Neo4j Tests You can use `@DataNeo4jTest` to test Neo4j applications. -By default, it uses an in-memory embedded Neo4j (if the embedded driver is available), scans for `@NodeEntity` classes, and configures Spring Data Neo4j repositories. +By default, it scans for `@Node` classes, and configures Spring Data Neo4j repositories. Regular `@Component` beans are not loaded into the `ApplicationContext`. (For more about using Neo4J with Spring Boot, see "<>", earlier in this chapter.) diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTest.java index 24e980506b..051a1eb119 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,9 +44,8 @@ import org.springframework.transaction.annotation.Transactional; * Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to Neo4j tests. *

- * By default, tests annotated with {@code @DataNeo4jTest} will use an embedded in-memory - * Neo4j process (if available). They will also be transactional with the usual - * test-related semantics (i.e. rollback by default). + * By default, tests annotated with {@code @DataNeo4jTest} are transactional with the + * usual test-related semantics (i.e. rollback by default). *

* When using JUnit 4, this annotation should be used in combination with * {@code @RunWith(SpringRunner.class)}.