mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-14 08:02: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;
|
private final GenericConversionService conversionService;
|
||||||
// don't access directly, use getConversions(). to prevent null access
|
// don't access directly, use getConversions(). to prevent null access
|
||||||
private CustomConversions conversions = new ElasticsearchCustomConversions(Collections.emptyList());
|
private CustomConversions conversions = new ElasticsearchCustomConversions(Collections.emptyList());
|
||||||
|
private final SpELContext spELContext = new SpELContext(new MapAccessor());
|
||||||
|
private final EntityInstantiators instantiators = new EntityInstantiators();
|
||||||
|
|
||||||
public MappingElasticsearchConverter(
|
public MappingElasticsearchConverter(
|
||||||
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
|
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
|
||||||
@ -159,7 +161,7 @@ public class MappingElasticsearchConverter
|
|||||||
@Override
|
@Override
|
||||||
public <R> R read(Class<R> type, Document source) {
|
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);
|
return reader.read(type, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,14 +202,16 @@ public class MappingElasticsearchConverter
|
|||||||
private static class Reader extends Base {
|
private static class Reader extends Base {
|
||||||
|
|
||||||
private final SpELContext spELContext;
|
private final SpELContext spELContext;
|
||||||
private final EntityInstantiators instantiators = new EntityInstantiators();
|
private final EntityInstantiators instantiators;
|
||||||
|
|
||||||
public Reader(
|
public Reader(
|
||||||
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext,
|
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext,
|
||||||
GenericConversionService conversionService, CustomConversions conversions) {
|
GenericConversionService conversionService, CustomConversions conversions, SpELContext spELContext,
|
||||||
|
EntityInstantiators instantiators) {
|
||||||
|
|
||||||
super(mappingContext, conversionService, conversions);
|
super(mappingContext, conversionService, conversions);
|
||||||
this.spELContext = new SpELContext(new MapAccessor());
|
this.spELContext = spELContext;
|
||||||
|
this.instantiators = instantiators;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user