无法将 @SortDefault 排序对象传递给控制器​​方法?

Cannot pass @SortDefault Sort object into controller method?

@SortDefault 的文档中指出

Annotation to define the default Sort options to be used when injecting a Sort instance into a controller handler method.

但事实是,我得到了这个例外:

Failed to instantiate [org.springframework.data.domain.Sort]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.data.domain.Sort.()

我是不是漏掉了什么?

void download(WebRequest request, HttpSession session,
      @RequestParam(value = "fields",
          defaultValue = "id,hostname,networkId,customerId") String[] visibleProperties,
      @SortDefault("hostname") Sort sort, HttpServletResponse response) {
}

您可能在配置中遗漏了 @EnableSpringDataWebSupport