Spring mongo:存储库不再工作

Spring mongo:存储库不再工作,spring,mongodb,Spring,Mongodb,我有这个配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mongo=

我有这个配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mongo="http://www.springframework.org/schema/data/mongo"
    xsi:schemaLocation="http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/data/mongo
      http://www.springframework.org/schema/data/mongo/spring-mongo.xsd
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd">

    <mongo:repositories base-package="com.x.record.persistence.repo"
        mongo-template-ref="mongoTemplate" />

    <context:component-scan base-package="com.x.record.persistence.impl" />

</beans>
有什么想法吗

更新: 如果我使用MongoRepository而不是Paging和SortingRepository,它会起作用:

这不起作用(对于1.6.x及以上版本): 公共接口RecordRepository扩展了分页和排序存储库,RecordRepositoryCustom{

    Page<Record> findByOrgHierarchy( String orgId, Pageable pageable );

    Record findOneByIdAndOrgHierarchyIn( String id, Collection<String> orgIds );

    int countByGsRunId(String gsRunId);

}
    Page<Record> findByOrgHierarchy( String orgId, Pageable pageable );

    Record findOneByIdAndOrgHierarchyIn( String id, Collection<String> orgIds );

    int countByGsRunId(String gsRunId);

}
Page findByOrgHierarchy(字符串orgId,可分页);
记录findOneByIdAndOrgHierarchyIn(字符串id、集合组织id);
int countByGsRunId(字符串gsRunId);
}
这适用于(1.6.x及以上版本): 公共接口RecordRepository扩展了MongoRepository、RecordRepositoryCustom{

    Page<Record> findByOrgHierarchy( String orgId, Pageable pageable );

    Record findOneByIdAndOrgHierarchyIn( String id, Collection<String> orgIds );

    int countByGsRunId(String gsRunId);

}
    Page<Record> findByOrgHierarchy( String orgId, Pageable pageable );

    Record findOneByIdAndOrgHierarchyIn( String id, Collection<String> orgIds );

    int countByGsRunId(String gsRunId);

}
Page findByOrgHierarchy(字符串orgId,可分页);
记录findOneByIdAndOrgHierarchyIn(字符串id、集合组织id);
int countByGsRunId(字符串gsRunId);
}
最糟糕的是,我有其他的repo可以使用paging和sortingrepository

Try sample,如果它在最新版本中工作,那么您的某些组件可能仍在使用旧版本,并且可能存在不兼容状态


粘贴完整的代码,以便社区可以测试问题。

您的noAuthRecordPersistenceService位于哪里?这可能是您的上下文:组件扫描太窄,spring没有实例化该服务。我尝试过这种配置,它适用于我的两个版本:1.5.X和1.6.X。您能否共享更多数据:pom.xml、存储库和服务代码等。。。?