This is currently not support mostly due to the fact the the component translating the sorting HTTP request parameters only considers property name and direction. I've filed DATACMNS-658 for you to keep track of this requirement.
As a workaround you could write an aspect that intercepts calls to the query methods that you want to enforce case-ignored sorting to be applied:
@Aspect
static class SortManipulatingAspect {
/**
* Intercept all calls to repositories. Might wanna be more specific in the
* pointcut to maker sure you don't unnecessarily intercept methods without
* a Sort.
*/
@Around("execution(public * org.springframework.data.repository.Repository+.*(..))")
public Object enableIgnoreCaseSorting(ProceedingJoinPoint joinPoint) throws Throwable {
return joinPoint.proceed(
Arrays.stream(joinPoint.getArgs()).map(sortWithIgnoreCase()).toArray()
);
}
private static Function<Object, Object> sortWithIgnoreCase() {
return (arg) -> arg instanceof Sort ? new Sort(
toOrderStream((Sort) arg).
// Insert filter here to be selective about which orders to actually
// activate ignore-case on.
map(order -> order.ignoreCase()).//
collect(Collectors.toList())) : arg;
}
private static Stream<Order> toOrderStream(Sort sort) {
return StreamSupport.stream(sort.spliterator(), false);
}
}
If you declare make this class a Spring bean (by pick-up through component scanning or explicit registration) all Sort
instances will get ignore-case being activated.