Skip to content

Commit

Permalink
Don't scan for @Persistent types as they may not be meant for Neo4j
Browse files Browse the repository at this point in the history
Closes gh-25069
  • Loading branch information
wilkinsona committed Feb 17, 2021
1 parent 34150d0 commit 08e8674
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -35,7 +35,6 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.annotation.Persistent;
import org.springframework.data.neo4j.core.DatabaseSelectionProvider;
import org.springframework.data.neo4j.core.Neo4jClient;
import org.springframework.data.neo4j.core.Neo4jOperations;
Expand Down Expand Up @@ -78,7 +77,7 @@ public Neo4jConversions neo4jConversions() {
@ConditionalOnMissingBean
public Neo4jMappingContext neo4jMappingContext(ApplicationContext applicationContext,
Neo4jConversions neo4jConversions) throws ClassNotFoundException {
Set<Class<?>> initialEntityClasses = new EntityScanner(applicationContext).scan(Node.class, Persistent.class,
Set<Class<?>> initialEntityClasses = new EntityScanner(applicationContext).scan(Node.class,
RelationshipProperties.class);
Neo4jMappingContext context = new Neo4jMappingContext(neo4jConversions);
context.setInitialEntitySet(initialEntityClasses);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -148,7 +148,7 @@ void shouldFilterInitialEntityScanWithKnownAnnotations() {
this.contextRunner.withUserConfiguration(EntityScanConfig.class).run((context) -> {
Neo4jMappingContext mappingContext = context.getBean(Neo4jMappingContext.class);
assertThat(mappingContext.hasPersistentEntityFor(TestNode.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestPersistent.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestPersistent.class)).isFalse();
assertThat(mappingContext.hasPersistentEntityFor(TestRelationshipProperties.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestNonAnnotated.class)).isFalse();
});
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
Expand Down Expand Up @@ -132,7 +132,7 @@ void shouldFilterInitialEntityScanWithKnownAnnotations() {
this.contextRunner.withUserConfiguration(EntityScanConfig.class).run((context) -> {
Neo4jMappingContext mappingContext = context.getBean(Neo4jMappingContext.class);
assertThat(mappingContext.hasPersistentEntityFor(TestNode.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestPersistent.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestPersistent.class)).isFalse();
assertThat(mappingContext.hasPersistentEntityFor(TestRelationshipProperties.class)).isTrue();
assertThat(mappingContext.hasPersistentEntityFor(TestNonAnnotated.class)).isFalse();
});
Expand Down

0 comments on commit 08e8674

Please sign in to comment.