DATACMNS-1743 - Fix lazy repository lookups in DomainClassConverter.
We now eagerly register DomainClassConverter as converter with the ConversionService in the web setup. We also refrain from explicitly registering the traget converters with the ConversionService as that might trigger a ConcurrentModificationException if called during an iteration over the converters in the first place. As DomainClassConverter registers itself for all ConvertiblePairs and delegates to the individual converters anyway.
This commit is contained in:
@@ -62,6 +62,7 @@ public class DomainClassConverter<T extends ConversionService & ConverterRegistr
|
||||
Assert.notNull(conversionService, "ConversionService must not be null!");
|
||||
|
||||
this.conversionService = conversionService;
|
||||
this.conversionService.addConverter(this);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -112,10 +113,7 @@ public class DomainClassConverter<T extends ConversionService & ConverterRegistr
|
||||
Repositories repositories = new Repositories(context);
|
||||
|
||||
this.toEntityConverter = Optional.of(new ToEntityConverter(repositories, conversionService));
|
||||
this.toEntityConverter.ifPresent(it -> conversionService.addConverter(it));
|
||||
|
||||
this.toIdConverter = Optional.of(new ToIdConverter(repositories, conversionService));
|
||||
this.toIdConverter.ifPresent(it -> conversionService.addConverter(it));
|
||||
|
||||
return repositories;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user