Skip to content

Commit

Permalink
GH-2133 - Remove o.s.d.annotation.Persistent from the set of identi…
Browse files Browse the repository at this point in the history
…fying annotations.

This removes `@Persistent` from the set that is used as so called
identifying annotations inside the repository configuration.

This change makes the process of identifying a repository as Neo4j
repository more strict: While it doesn't change anything in a single
store scenario - repository is selected by the entity being managed and
that is still `@Persistent` - it will fix missidentifying a repository
of another store as elligable for being a Neo4j repository.

This fixes #2133.
  • Loading branch information
michael-simons committed Feb 2, 2021
1 parent 2715591 commit f18e746
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Expand Up @@ -23,6 +23,7 @@

import org.apiguardian.api.API;
import org.springframework.core.annotation.AliasFor;
import org.springframework.data.annotation.Persistent;

/**
* The annotation to configure the mapping from a node with a given set of labels to a class and vice versa.
Expand All @@ -33,7 +34,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@org.springframework.data.annotation.Persistent
@Persistent
@API(status = API.Status.STABLE, since = "6.0")
public @interface Node {

Expand Down
Expand Up @@ -25,7 +25,6 @@
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.data.annotation.Persistent;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.RelationshipProperties;
import org.springframework.data.neo4j.repository.Neo4jRepository;
Expand Down Expand Up @@ -71,7 +70,7 @@ public Neo4jRepositoryConfigurationExtension() {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config14.RepositoryConfigurationExtension#getRepositoryFactoryBeanClassName()
* @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getRepositoryFactoryBeanClassName()
*/
@Override
public String getRepositoryFactoryBeanClassName() {
Expand All @@ -80,7 +79,7 @@ public String getRepositoryFactoryBeanClassName() {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config14.RepositoryConfigurationExtensionSupport#getModulePrefix()
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
*/
@Override
protected String getModulePrefix() {
Expand All @@ -89,7 +88,7 @@ protected String getModulePrefix() {

@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
return Arrays.asList(Node.class, RelationshipProperties.class, Persistent.class);
return Arrays.asList(Node.class, RelationshipProperties.class);
}

@Override
Expand Down
Expand Up @@ -25,7 +25,6 @@
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.data.annotation.Persistent;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.RelationshipProperties;
import org.springframework.data.neo4j.repository.ReactiveNeo4jRepository;
Expand Down Expand Up @@ -71,7 +70,7 @@ public ReactiveNeo4jRepositoryConfigurationExtension() {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config14.RepositoryConfigurationExtension#getRepositoryFactoryBeanClassName()
* @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getRepositoryFactoryBeanClassName()
*/
@Override
public String getRepositoryFactoryBeanClassName() {
Expand All @@ -80,7 +79,7 @@ public String getRepositoryFactoryBeanClassName() {

/*
* (non-Javadoc)
* @see org.springframework.data.repository.config14.RepositoryConfigurationExtensionSupport#getModulePrefix()
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
*/
@Override
protected String getModulePrefix() {
Expand All @@ -89,7 +88,7 @@ protected String getModulePrefix() {

@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
return Arrays.asList(Node.class, RelationshipProperties.class, Persistent.class);
return Arrays.asList(Node.class, RelationshipProperties.class);
}

@Override
Expand Down

0 comments on commit f18e746

Please sign in to comment.