38
38
import org .springframework .util .Assert ;
39
39
import org .springframework .util .CollectionUtils ;
40
40
import org .springframework .util .ConcurrentReferenceHashMap ;
41
+ import org .springframework .util .ConcurrentReferenceHashMap .ReferenceType ;
41
42
import org .springframework .util .MultiValueMap ;
42
43
import org .springframework .util .StringUtils ;
43
44
@@ -105,8 +106,9 @@ public BasicPersistentEntity(TypeInformation<T> information, @Nullable Comparato
105
106
this .associations = comparator == null ? new HashSet <>() : new TreeSet <>(new AssociationComparator <>(comparator ));
106
107
107
108
this .propertyCache = new ConcurrentHashMap <>();
108
- this .annotationCache = new ConcurrentReferenceHashMap <>();
109
- this .propertyAnnotationCache = CollectionUtils .toMultiValueMap (new ConcurrentReferenceHashMap <>());
109
+ this .annotationCache = new ConcurrentReferenceHashMap <>(16 , ReferenceType .WEAK );
110
+ this .propertyAnnotationCache = CollectionUtils
111
+ .toMultiValueMap (new ConcurrentReferenceHashMap <>(16 , ReferenceType .WEAK ));
110
112
this .propertyAccessorFactory = BeanWrapperPropertyAccessorFactory .INSTANCE ;
111
113
this .typeAlias = Lazy .of (() -> getAliasFromAnnotation (getType ()));
112
114
this .isNewStrategy = Lazy .of (() -> Persistable .class .isAssignableFrom (information .getType ()) //
@@ -236,7 +238,7 @@ public void addPersistentProperty(P property) {
236
238
}
237
239
}
238
240
239
- /*
241
+ /*
240
242
* (non-Javadoc)
241
243
* @see org.springframework.data.mapping.model.MutablePersistentEntity#setEvaluationContextProvider(org.springframework.data.spel.EvaluationContextProvider)
242
244
*/
@@ -469,7 +471,7 @@ public IdentifierAccessor getIdentifierAccessor(Object bean) {
469
471
return hasIdProperty () ? new IdPropertyIdentifierAccessor (this , bean ) : new AbsentIdentifierAccessor (bean );
470
472
}
471
473
472
- /*
474
+ /*
473
475
* (non-Javadoc)
474
476
* @see org.springframework.data.mapping.PersistentEntity#isNew(java.lang.Object)
475
477
*/
@@ -481,7 +483,7 @@ public boolean isNew(Object bean) {
481
483
return isNewStrategy .get ().isNew (bean );
482
484
}
483
485
484
- /*
486
+ /*
485
487
* (non-Javadoc)
486
488
* @see org.springframework.data.mapping.PersistentEntity#isImmutable()
487
489
*/
@@ -516,7 +518,7 @@ protected EvaluationContext getEvaluationContext(Object rootObject) {
516
518
* Returns the default {@link IsNewStrategy} to be used. Will be a {@link PersistentEntityIsNewStrategy} by default.
517
519
* Note, that this strategy only gets used if the entity doesn't implement {@link Persistable} as this indicates the
518
520
* user wants to be in control over whether an entity is new or not.
519
- *
521
+ *
520
522
* @return
521
523
* @since 2.1
522
524
*/
@@ -526,7 +528,7 @@ protected IsNewStrategy getFallbackIsNewStrategy() {
526
528
527
529
/**
528
530
* Verifies the given bean type to no be {@literal null} and of the type of the current {@link PersistentEntity}.
529
- *
531
+ *
530
532
* @param bean must not be {@literal null}.
531
533
*/
532
534
private final void verifyBeanType (Object bean ) {
0 commit comments