diff --git a/src/main/java/org/springframework/data/repository/query/Parameters.java b/src/main/java/org/springframework/data/repository/query/Parameters.java index 721f6341f..b8b13a10b 100644 --- a/src/main/java/org/springframework/data/repository/query/Parameters.java +++ b/src/main/java/org/springframework/data/repository/query/Parameters.java @@ -65,15 +65,15 @@ public abstract class Parameters, T extends Parameter Assert.notNull(method, "Method must not be null!"); - List> types = Arrays.asList(method.getParameterTypes()); + Class[] types = method.getParameterTypes(); - this.parameters = new ArrayList<>(types.size()); + this.parameters = new ArrayList<>(types.length); this.dynamicProjectionIndex = -1; int pageableIndex = -1; int sortIndex = -1; - for (int i = 0; i < types.size(); i++) { + for (int i = 0; i < types.length; i++) { MethodParameter methodParameter = new MethodParameter(method, i); methodParameter.initParameterNameDiscovery(discoverer); diff --git a/src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java b/src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java index c27126063..f8e5c8fc4 100644 --- a/src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java +++ b/src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java @@ -300,12 +300,13 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker { Method method = methods.getFindAllMethod() .orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-all-method declared!")); - Class[] types = method.getParameterTypes(); - if (types.length == 0) { + if (method.getParameterCount() == 0) { return invokeForNonNullResult(method); } + Class[] types = method.getParameterTypes(); + if (Pageable.class.isAssignableFrom(types[0])) { return invokeForNonNullResult(method, pageable); } diff --git a/src/main/java/org/springframework/data/spel/spi/Function.java b/src/main/java/org/springframework/data/spel/spi/Function.java index 22294526e..40e471150 100644 --- a/src/main/java/org/springframework/data/spel/spi/Function.java +++ b/src/main/java/org/springframework/data/spel/spi/Function.java @@ -166,6 +166,7 @@ public class Function { public boolean isSignatureEqual(Function other) { return getName().equals(other.getName()) // + && method.getParameterCount() == other.method.getParameterCount() && Arrays.equals(method.getParameterTypes(), other.method.getParameterTypes()); } }