我正在使用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());
}
}
我在做什么错了?