簡體   English   中英

無法實例化[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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM