mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-05-31 01:02:12 +00:00
DATAES-989 - Improve deprecation warning for id properties without annotation.
Original PR: #563
This commit is contained in:
parent
c66443ab5a
commit
8e59b18931
@ -24,6 +24,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.elasticsearch.annotations.DateFormat;
|
import org.springframework.data.elasticsearch.annotations.DateFormat;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
import org.springframework.data.elasticsearch.annotations.Field;
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
import org.springframework.data.elasticsearch.annotations.FieldType;
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
import org.springframework.data.elasticsearch.annotations.GeoPointField;
|
import org.springframework.data.elasticsearch.annotations.GeoPointField;
|
||||||
@ -83,9 +84,9 @@ public class SimpleElasticsearchPersistentProperty extends
|
|||||||
// deprecated since 4.1
|
// deprecated since 4.1
|
||||||
@Deprecated
|
@Deprecated
|
||||||
boolean isIdWithoutAnnotation = isId && !isAnnotationPresent(Id.class);
|
boolean isIdWithoutAnnotation = isId && !isAnnotationPresent(Id.class);
|
||||||
if (isIdWithoutAnnotation) {
|
if (isIdWithoutAnnotation && owner.isAnnotationPresent(Document.class)) {
|
||||||
LOGGER.warn("Using the property name of '{}' to identify the id property is deprecated."
|
LOGGER.warn("Using the property name of '{}' to identify the id property is deprecated."
|
||||||
+ " Please annotate the id property with '@Id'", getName());
|
+ " Please annotate the id property with '@Id'", owner.getName() + "." + getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isScore = isAnnotationPresent(Score.class);
|
this.isScore = isAnnotationPresent(Score.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user