DATACMNS-1172 - Removed ability to use scanning all packages for repository implementations again.

Kept in a separate commit, so that it's easy to add again by reverting this commit. Removed, as the new behavior is effectively what had been documented as intended behavior all the time.

Original pull request: #248.
This commit is contained in:
Oliver Gierke
2017-09-27 16:05:41 +02:00
parent da88163141
commit 8da9679fc1
8 changed files with 3 additions and 98 deletions

View File

@@ -65,7 +65,6 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
private static final String REPOSITORY_FACTORY_BEAN_CLASS = "repositoryFactoryBeanClass";
private static final String REPOSITORY_BASE_CLASS = "repositoryBaseClass";
private static final String CONSIDER_NESTED_REPOSITORIES = "considerNestedRepositories";
private static final String LIMIT_IMPLEMENTATION_BASE_PACKAGES = "limitImplementationBasePackages";
private final AnnotationMetadata configMetadata;
private final AnnotationMetadata enableAnnotationMetadata;
@@ -322,20 +321,6 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
return attributes.containsKey(CONSIDER_NESTED_REPOSITORIES) && attributes.getBoolean(CONSIDER_NESTED_REPOSITORIES);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationSourceSupport#shouldLimitRepositoryImplementationBasePackages()
*/
@Override
public boolean shouldLimitRepositoryImplementationBasePackages() {
if (!attributes.containsKey(LIMIT_IMPLEMENTATION_BASE_PACKAGES)) {
return true;
}
return attributes.getBoolean(LIMIT_IMPLEMENTATION_BASE_PACKAGES);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationSource#getAttribute(java.lang.String)

View File

@@ -78,10 +78,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
*/
@Override
public Streamable<String> getImplementationBasePackages() {
return configurationSource.shouldLimitRepositoryImplementationBasePackages()
? Streamable.of(ClassUtils.getPackageName(getRepositoryInterface()))
: getBasePackages();
return Streamable.of(ClassUtils.getPackageName(getRepositoryInterface()));
}
/*

View File

@@ -311,10 +311,7 @@ class RepositoryBeanDefinitionBuilder {
* @return
*/
public Iterable<String> getBasePackages() {
return configuration.getConfigurationSource().shouldLimitRepositoryImplementationBasePackages() ? //
Collections.singleton(ClassUtils.getPackageName(fragmentInterfaceName)) : //
configuration.getImplementationBasePackages();
return Collections.singleton(ClassUtils.getPackageName(fragmentInterfaceName));
}
/**

View File

@@ -63,17 +63,6 @@ public interface RepositoryConfigurationSource {
*/
Optional<String> getRepositoryImplementationPostfix();
/**
* Returns whether to limit repository implementation base packages for custom implementation scanning. If
* {@literal true}, then custom implementation scanning considers only the package of the repository/fragment
* interface and its subpackages for a scan. Otherwise, all {@link #getBasePackages()} are scanned for repository
* implementations
*
* @return {@literal true} if base packages are limited to the actual repository package.
* @since 2.0
*/
boolean shouldLimitRepositoryImplementationBasePackages();
/**
* @return
*/

View File

@@ -117,13 +117,4 @@ public abstract class RepositoryConfigurationSourceSupport implements Repository
public boolean shouldConsiderNestedRepositories() {
return false;
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationSource#isLimitRepositoryImplementationBasePackages()
*/
@Override
public boolean shouldLimitRepositoryImplementationBasePackages() {
return true;
}
}