zoukankan      html  css  js  c++  java
  • Could not instantiate bean class [org.springframework.data.domain.Pageable]: Specified class is an interface解决方案

    原文:http://pimin.net/archives/432

    环境:Eclipse LUNA、Spring 4.1.1、或Spring 4.3.3、Spring Data Elasticsearch 1.1.0

    缘由:在调试Spring Data Elasticsearch的时候,希望在查询的时候实现分页查询。传统的方式就是在Controller的参数表中自己获取分页信息,然后组装成Pageable。在Spring Data Elasticsearch官方文档介绍有两种自动化方案:

    1、使用<bean class=”org.springframework.data.web.config.SpringDataWebConfiguration” />

    官方介绍说可以注册DomainClassConverter和HandlerMethodArgumentResolver。

    2、配置org.springframework.data.web.PageableHandlerMethodArgumentResolver

    很遗憾,使用这两种方法后直接报错:

    解决方案,那就是在web-context.xml加入下面的代码

    <mvc:annotation-driven>
    <mvc:argument-resolvers>
    <bean class="org.springframework.data.web.PageableHandlerMethodArgumentResolver" />
    </mvc:argument-resolvers>
    </mvc:annotation-driven>
  • 相关阅读:
    HDU 2546:饭卡(01背包)
    HPU 第三次积分赛:阶乘之和(水题)
    拓扑排序练习题
    HDU 2647:Reward(拓扑排序+队列)
    HDU 3342:Legal or Not(拓扑排序)
    HDU 2094:产生冠军(拓扑排序)
    POJ 2585:Window Pains(拓扑排序)
    51Nod 1002:数塔取数问题(DP)
    cogs696 longest prefix
    poj3764 The xor-longest Path
  • 原文地址:https://www.cnblogs.com/shihaiming/p/6019486.html
Copyright © 2011-2022 走看看