一尘不染

Spring Data java.lang.NoSuchMethodError

elasticsearch

春天来了

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> {

我该如何解决?


阅读 383

收藏
2020-06-22

共1个答案

一尘不染

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

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

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

2020-06-22