完整报错:
Description:
An attempt was made to call the method org.elasticsearch.client.RestHighLevelClient.<init>(Lorg/elasticsearch/client/RestClientBuilder;)V but it does not exist. Its class, org.elasticsearch.client.RestHighLevelClient, is available from the following locations:
jar:file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.10/elasticsearch-rest-high-level-client-5.6.10.jar!/org/elasticsearch/client/RestHighLevelClient.class
It was loaded from the following location:
file:/Users/user/.m2/repository/org/elasticsearch/client/elasticsearch-rest-high-level-client/5.6.10/elasticsearch-rest-high-level-client-5.6.10.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RestHighLevelClient
解决:
@SpringBootApplication(
scanBasePackages = {
"$packages$"
},
//加上这行,阻止springboot自己注入对象:
exclude={ElasticsearchAutoConfiguration.class, RestClientAutoConfiguration.class}
)
网友评论