/** * Checks the given method's parameters to match the ones of the given base class method. Matches generic arguments * agains the ones bound in the given repository interface. * * @param method * @param baseClassMethod * @return */ private boolean parametersMatch(Method method, Method baseClassMethod) { Type[] genericTypes = baseClassMethod.getGenericParameterTypes(); Class<?>[] types = baseClassMethod.getParameterTypes(); for (int i = 0; i < genericTypes.length; i++) { Type type = genericTypes[i]; MethodParameter parameter = new MethodParameter(method, i); Class<?> parameterType = resolveParameterType(parameter, metadata.getRepositoryInterface()); if (type instanceof TypeVariable<?>) { if (!matchesGenericType((TypeVariable<?>) type, parameterType)) { return false; } } else { if (!types[i].equals(parameterType)) { return false; } } } return true; }