1

春天在投掷

java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/ClassTypeInformation;
        at org.springframework.data.elasticsearch.core.MappingBuilder.isEntity(MappingBuilder.java:260)
        at org.springframework.data.elasticsearch.core.MappingBuilder.mapEntity(MappingBuilder.java:97)
        at org.springframework.data.elasticsearch.core.MappingBuilder.buildMapping(MappingBuilder.java:70)
        at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.putMapping(ElasticsearchTemplate.java:156)
        at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.putMapping(AbstractElasticsearchRepository.java:84)
        at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.<init>(AbstractElasticsearchRepository.java:73)
        at org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository.<init>(NumberKeyedRepository.java:36)
        at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getTargetRepository(ElasticsearchRepositoryFactory.java:73)
        at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:147)
        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162)
        at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
        at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)

这是我的存储库,这是导致问题的原因

@Repository("clinicalDocumentRepository")
public interface ConsultationDocumentRepo extends ElasticsearchCrudRepository<ConsultationDocument,Long> {

我该如何解决这个问题?

4

2 回答 2

4

ClassTypeInformation 在 1.1.0 版本中引入了该方法:

public static <S> TypeInformation<S> from(Class<S> type) {

确保您的 spring-data-commons 版本 >=1.1.0

于 2014-06-24T08:28:06.150 回答
1

对于当前的 Spring Data Elasticsearch 版本(1.0.0.RELEASE),您需要 1.8.0.RELEASE 中的 Spring Data Commons(正如pom建议的那样)。

一般而言,我们建议使用发布火车 BOM(如此所述)以确保您获得匹配版本中的所有 Spring Data 库。BOM 的当前版本是Dijkstra-RELEASE.

于 2014-06-24T14:59:04.927 回答