Skip to content

Commit 905565c

Browse files
committed
DATACMNS-332 - Cache AnnotationBasedPersistentProperty.isTransient().
1 parent 24bc432 commit 905565c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
4848
private final Value value;
4949
private final Map<Class<? extends Annotation>, Annotation> annotationCache = new HashMap<Class<? extends Annotation>, Annotation>();
5050

51+
private Boolean isTransient;
52+
5153
/**
5254
* Creates a new {@link AnnotationBasedPersistentProperty}.
5355
*
@@ -122,8 +124,12 @@ public String getSpelExpression() {
122124
@Override
123125
public boolean isTransient() {
124126

125-
boolean isTransient = super.isTransient() || isAnnotationPresent(Transient.class);
126-
return isTransient || isAnnotationPresent(Value.class) || isAnnotationPresent(Autowired.class);
127+
if (isTransient == null) {
128+
boolean isTransient = super.isTransient() || isAnnotationPresent(Transient.class);
129+
this.isTransient = isTransient || isAnnotationPresent(Value.class) || isAnnotationPresent(Autowired.class);
130+
}
131+
132+
return this.isTransient;
127133
}
128134

129135
/*

0 commit comments

Comments
 (0)