当我发送getUserPlaces?page=0&size=5
之类的请求时
我收到这个错误:
无法实例化[org.springframework.data.domain.Pageable]:指定的类是一个接口
我的控制器是:
@Controller
@EnableSpringDataWebSupport
public class UserController {
...
@RequestMapping(value = "/getUserPlaces", method = RequestMethod.POST)
public @ResponseBody List<PlaceDto> getUserPlaces(@RequestBody RoutePagingDto routeRequest, Pageable pageable) {
return placeService.placeToPlaceDto(userService.getUserPlaces(pageable));
}
在我的spring-context.xml中,我让它们声明了bean:
<beans:bean class="org.springframework.data.web.SortHandlerMethodArgumentResolver" />
<beans:bean class="org.springframework.data.web.PageableHandlerMethodArgumentResolver" />
我失踪了什么?
答案 0 :(得分:2)
从UserController类中删除[[
并使用以下代码创建WebConfig类
@EnableSpringDataWebSupport