![](/img/trans.png)
[英]No primary or default constructor found for interface org.springframework.data.domain.Pageable
[英]Failed to instantiate [org.springframework.data.domain.Pageable]: Specified class is an interface
当我发送类似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" />
我想念的是什么?
从UserController类中删除@EnableSpringDataWebSupport
,并使用以下代码创建WebConfig类
@Configuration
@EnableWebMvc
@EnableSpringDataWebSupport
public class WebConfig extends WebMvcConfigurationSupport {}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.