DATACMNS-763 - Fixed constructor in example of custom repository base class.
Added hint to which constructor of the superclass to override. Added test cas e to make sure the expected types are advertised in the case of an error.
This commit is contained in:
@@ -335,8 +335,16 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware {
|
||||
Constructor<?> constructor = ReflectionUtils.findConstructor(baseClass, constructorArguments);
|
||||
|
||||
if (constructor == null) {
|
||||
|
||||
List<Class<?>> argumentTypes = new ArrayList<Class<?>>(constructorArguments.length);
|
||||
|
||||
for (Object argument : constructorArguments) {
|
||||
argumentTypes.add(argument.getClass());
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format(
|
||||
"No suitable constructor found on %s to match the given arguments: %s", baseClass, constructorArguments));
|
||||
"No suitable constructor found on %s to match the given arguments: %s. Make sure you implement a constructor taking these",
|
||||
baseClass, argumentTypes));
|
||||
}
|
||||
|
||||
return (R) BeanUtils.instantiateClass(constructor, constructorArguments);
|
||||
|
||||
Reference in New Issue
Block a user