控制器中具有Pageable参数的Spring MVC不起作用

时间:2019-07-24 09:58:52

标签: spring-mvc pagination

我正在使用Spring MVC(不是Spring Boot),我的控制器如下所示:

public ResponseEntity<Page<Foo>> getAll(@PathVariable String accountId, @PageableDefault final Pageable pageable)

但是我遇到以下错误:

Request processing failed; nested exception is java.lang.IllegalStateException: No primary or
    default constructor found for interface org.springframework.data.domain.Pageable

即使我有用于配置的此类:

@Configuration
@EnableSpringDataWebSupport
public class PageableConfig extends WebMvcConfigurerAdapter {

@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
}

}

我在做什么错了?

0 个答案:

没有答案