DATACMNS-502 - Prevent IndexOutOfBoundException in AnnotationRepositoryConfigurationSource.
If a configuration class resides in the default package and no base package is defined in the @Enable…Repositories annotation we previously failed in extracting the package from the class name (as there is none). We now use Spring's ClassUtils that correctly handles this case and returns an empty String for the default package.
This commit is contained in:
@@ -95,7 +95,7 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
|
||||
// Default configuration - return package of annotated class
|
||||
if (value.length == 0 && basePackages.length == 0 && basePackageClasses.length == 0) {
|
||||
String className = metadata.getClassName();
|
||||
return Collections.singleton(className.substring(0, className.lastIndexOf('.')));
|
||||
return Collections.singleton(ClassUtils.getPackageName(className));
|
||||
}
|
||||
|
||||
Set<String> packages = new HashSet<String>();
|
||||
|
||||
Reference in New Issue
Block a user