How to solve the conflict between ElasticsearchRepository and @ Mapper registering Bean in SpringBoot

as mentioned in the question, I used Elasticsearch + mybatis. There was a problem in the integration. First, the figure

clipboard.png

@MapperElasticsearchRepositorymybatisElasticsearchdaoElasticsearchRepository

clipboard.png

articleDao beanActionspring.main.allow-bean-definition-overriding=true

clipboard.png

clipboard.png

Error creating bean with name "articleController": Unsatisfied dependency expressed through field "articleService"; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name "articleService": Unsatisfied dependency expressed through field "articleDao"; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name "articleDao": Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property search found for type Article!

ElasticsearchRepository

clipboard.png

Note Project environment is SpringBoot 2.1.1.RELEASE, elasticsearch dependency is spring-boot-starter-data-elasticsearch, same as 2.1.1.RELEASE

I don"t know if it"s because of the addition of

This problem just came out of

spring.main.allow-bean-definition-overriding=true, but the problem of repeatedly registering bean has been solved, and this is the next problem. For those who have encountered related problems, please help

.
Jun.07,2022

replace @ Mapper with @ Repository
@ Mapper is mybatis's comment, which is handled by mybatis and may conflict with spring data's comment


mybatis without @ Mapper annotation. Add the mapper scanner @ MapperScan ("com.abcd.mapper")


to Application . Have you finally solved it? Curiosity

Menu