spring-projects / spring-projects/spring-data-commons
DomainClassConverter not registered by SpringDataWebConfiguration [DATACMNS-1759]
@odrotbohm is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 838
- Forks
- 730
- PR merge metrics
- No merged PRs in 30d
Description
Martin Hjalmarsson opened DATACMNS-1759 and commented
Version 2.3.1 of DomainClassConverter introduced lazy initialization of Repositories in setApplicationContext(context):
this.repositories = Lazy.of(() -> {
Repositories repositories = new Repositories(context);
[...]
return repositories;
});
The problem with this is that SpringDataWebConfiguration (@EnableSpringDataWebSupport) creates an instance of DomainClassConverter but then never registers it anywhere so the instance is discarded(?).
DomainClassConverter<FormattingConversionService> converter = new DomainClassConverter<>(conversionService);
converter.setApplicationContext(context);
Before the change was introduced the DomainClassConverter would register Id- and Type-converters immediately in the setApplicationContext method.
Either SpringDataWebConfiguration needs to register the DomainClassConverter in the ConversionService, i.e. conversionService.registerConverter(converter);
Or DomainClassConverter should do that it self in the setApplicationContext method
Affects: 2.3.1 (Neumann SR1)
3 votes, 3 watchers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.