mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-21 03:22:11 +00:00
DATAES-471 - Adapt object property access behavior after changes in Spring Data Commons.
Changes made for Spring Data Commons result in final fields being rejected for manipulation unless there's a wither method available on the object at hand. Unfortunately adapting Spring Data Elasticsearch to support that doesn't work easily as it requires breaking changes to ElasticsearchTemplate as most of the methods assume parameters being handed to be mutable, see the implementation of SimpleElasticsearchRepository.save(…) for instance. We now mitigate the problem, by enforcing the BeanWrapperPropertyAccessor being used and treating all properties as mutable. Related tickets: DATACMNS-1322.
This commit is contained in:
parent
143a359eca
commit
cdbc832068
@ -28,7 +28,9 @@ import org.springframework.data.elasticsearch.annotations.Document;
|
||||
import org.springframework.data.elasticsearch.annotations.Parent;
|
||||
import org.springframework.data.elasticsearch.annotations.Setting;
|
||||
import org.springframework.data.mapping.MappingException;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.mapping.model.BasicPersistentEntity;
|
||||
import org.springframework.data.mapping.model.PersistentPropertyAccessorFactory;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ParserContext;
|
||||
@ -195,4 +197,16 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
||||
this.scoreProperty = property;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.model.BasicPersistentEntity#setPersistentPropertyAccessorFactory(org.springframework.data.mapping.model.PersistentPropertyAccessorFactory)
|
||||
*/
|
||||
@Override
|
||||
public void setPersistentPropertyAccessorFactory(PersistentPropertyAccessorFactory factory) {
|
||||
|
||||
// Do nothing to avoid the usage of ClassGeneratingPropertyAccessorFactory for now
|
||||
// DATACMNS-1322 switches to proper immutability behavior which Spring Data Elasticsearch
|
||||
// cannot yet implement
|
||||
}
|
||||
}
|
||||
|
@ -85,4 +85,13 @@ public class SimpleElasticsearchPersistentProperty extends
|
||||
public boolean isScoreProperty() {
|
||||
return isScore;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.model.AbstractPersistentProperty#isImmutable()
|
||||
*/
|
||||
@Override
|
||||
public boolean isImmutable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user