mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-13 07:32:11 +00:00
Fix MappingElasticsearchConverter memory leak.
Original Pull Request #1928 Closes #1924
This commit is contained in:
parent
6941e31ba4
commit
7c35e5327e
@ -97,6 +97,8 @@ public class MappingElasticsearchConverter
|
||||
private final GenericConversionService conversionService;
|
||||
// don't access directly, use getConversions(). to prevent null access
|
||||
private CustomConversions conversions = new ElasticsearchCustomConversions(Collections.emptyList());
|
||||
private final SpELContext spELContext = new SpELContext(new MapAccessor());
|
||||
private final EntityInstantiators instantiators = new EntityInstantiators();
|
||||
|
||||
public MappingElasticsearchConverter(
|
||||
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
|
||||
@ -159,7 +161,7 @@ public class MappingElasticsearchConverter
|
||||
@Override
|
||||
public <R> R read(Class<R> type, Document source) {
|
||||
|
||||
Reader reader = new Reader(mappingContext, conversionService, getConversions());
|
||||
Reader reader = new Reader(mappingContext, conversionService, getConversions(), spELContext, instantiators);
|
||||
return reader.read(type, source);
|
||||
}
|
||||
|
||||
@ -200,14 +202,16 @@ public class MappingElasticsearchConverter
|
||||
private static class Reader extends Base {
|
||||
|
||||
private final SpELContext spELContext;
|
||||
private final EntityInstantiators instantiators = new EntityInstantiators();
|
||||
private final EntityInstantiators instantiators;
|
||||
|
||||
public Reader(
|
||||
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext,
|
||||
GenericConversionService conversionService, CustomConversions conversions) {
|
||||
GenericConversionService conversionService, CustomConversions conversions, SpELContext spELContext,
|
||||
EntityInstantiators instantiators) {
|
||||
|
||||
super(mappingContext, conversionService, conversions);
|
||||
this.spELContext = new SpELContext(new MapAccessor());
|
||||
this.spELContext = spELContext;
|
||||
this.instantiators = instantiators;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
Loading…
x
Reference in New Issue
Block a user