(黑马十次方项目day04)An attempt was made to call a method that does not exist. The attempt was made from the following location:
*************************** APPLICATION FAILED TO START *************************** Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.data.elasticsearch.client.TransportClientFactoryBean.settings(TransportClientFactoryBean.java:106) The following method did not exist: org.elasticsearch.common.settings.Settings$Builder.put(Ljava/util/Dictionary;)Lorg/elasticsearch/common/settings/Settings$Builder; The method's class, org.elasticsearch.common.settings.Settings$Builder, is available from the following locations: jar:file:/D:/apache-maven-3.6.1/MavenRepo/org/elasticsearch/elasticsearch/6.4.3/elasticsearch-6.4.3.jar!/org/elasticsearch/common/settings/Settings$Builder.class It was loaded from the following location: file:/D:/apache-maven-3.6.1/MavenRepo/org/elasticsearch/elasticsearch/6.4.3/elasticsearch-6.4.3.jar Action: Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.common.settings.Settings$Builder 进程已结束,退出代码 1
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-elasticsearch</artifactId> <version>3.0.9.RELEASE</version> </dependency>
spring-data-elasticsearch版本3.0.6报错
spring-data-elasticsearch版本3.0.9报错
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'articleSearchService': Unsatisfied dependency expressed
through field 'articleSearchDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'articleSearchDao': Cannot
resolve reference to bean 'elasticsearchTemplate' while setting bean property 'elasticsearchOperations'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'elasticsearchTemplate' defined in class
path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchDataAutoConfiguration.class]: Unsatisfied dependency expressed through method
'elasticsearchTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchClient'
defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]: Bean instantiation via factory method
failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory
method 'elasticsearchClient' threw exception;
换成 spring-data-elasticsearch版本3.1.10 即可