Spring confuses "mappingContext" when spring-data-elasticsearch is included
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
To reproduce, created a clean grails 3.1.x project (with `grails create-app myapp`) and then adding the dependency `compile 'org.springframework.data:spring-data-elasticsearch'`.
When I try to run (this is obviously just a subset of the full error, but you get the idea):
`Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext] to required type [org.grails.datastore.mapping.model.MappingContext] for property 'mappingContext'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext] to required type [org.grails.datastore.mapping.model.MappingContext] for property 'mappingContext': no matching editors or conversion strategy found`
It has something to do with both using the bean "mappingContext" but I'm puzzled because as far as I can see, the `org.grails.web.mapping.DefaultLinkGenerator` has a `@Qualifier('grailsDomainClassMappingContext')` on the `mappingContext` and I know the spring-data-elasticsearch wouldn't get confused with a grails\* anything.
Contributor guide
Research direction
Reproduce the failure in a clean Grails 3.1.x app created with `grails create-app myapp` after adding `spring-data-elasticsearch`. Start by inspecting `org.grails.web.mapping.DefaultLinkGenerator`, its `mappingContext` property, and the reported bean-creation error. Done means the application starts without the conversion error between the Elasticsearch and Grails mapping contexts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, groovy, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100