Skip to content

Commit d9aa662

Browse files
GH-2488 - Use default database selection.
Fixes #2488.
1 parent 052d716 commit d9aa662

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/main/java/org/springframework/data/neo4j/core/Neo4jTemplate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingCo
130130

131131
this(neo4jClient, neo4jMappingContext, EntityCallbacks.create());
132132

133-
if (databaseSelectionProvider != neo4jClient.getDatabaseSelectionProvider()) {
133+
if (!Objects.equals(databaseSelectionProvider, neo4jClient.getDatabaseSelectionProvider())) {
134134
throw new IllegalStateException(
135135
"The provided database selection provider differs from the Neo4jClient's one.");
136136
}
@@ -142,7 +142,7 @@ public Neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingCo
142142

143143
this(neo4jClient, neo4jMappingContext, entityCallbacks);
144144

145-
if (databaseSelectionProvider != neo4jClient.getDatabaseSelectionProvider()) {
145+
if (!Objects.equals(databaseSelectionProvider, neo4jClient.getDatabaseSelectionProvider())) {
146146
throw new IllegalStateException(
147147
"The provided database selection provider differs from the Neo4jClient's one.");
148148
}

src/main/java/org/springframework/data/neo4j/core/ReactiveNeo4jTemplate.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.util.LinkedHashSet;
3838
import java.util.List;
3939
import java.util.Map;
40+
import java.util.Objects;
4041
import java.util.Set;
4142
import java.util.concurrent.ConcurrentHashMap;
4243
import java.util.concurrent.atomic.AtomicReference;
@@ -132,7 +133,7 @@ public ReactiveNeo4jTemplate(ReactiveNeo4jClient neo4jClient, Neo4jMappingContex
132133
ReactiveDatabaseSelectionProvider databaseSelectionProvider) {
133134

134135
this(neo4jClient, neo4jMappingContext);
135-
if (databaseSelectionProvider != neo4jClient.getDatabaseSelectionProvider()) {
136+
if (!Objects.equals(databaseSelectionProvider, neo4jClient.getDatabaseSelectionProvider())) {
136137
throw new IllegalStateException("The provided database selection provider differs from the ReactiveNeo4jClient's one.");
137138
}
138139
}

0 commit comments

Comments
 (0)