|
21 | 21 | import java.io.Serializable;
|
22 | 22 | import java.lang.annotation.Annotation;
|
23 | 23 | import java.util.*;
|
| 24 | +import java.util.concurrent.ConcurrentHashMap; |
24 | 25 | import java.util.stream.Collectors;
|
25 | 26 |
|
26 | 27 | import org.springframework.core.annotation.AnnotatedElementUtils;
|
|
31 | 32 | import org.springframework.data.util.TypeInformation;
|
32 | 33 | import org.springframework.lang.Nullable;
|
33 | 34 | import org.springframework.util.Assert;
|
34 |
| -import org.springframework.util.LinkedMultiValueMap; |
| 35 | +import org.springframework.util.CollectionUtils; |
| 36 | +import org.springframework.util.ConcurrentReferenceHashMap; |
| 37 | +import org.springframework.util.ConcurrentReferenceHashMap.ReferenceType; |
35 | 38 | import org.springframework.util.MultiValueMap;
|
36 | 39 | import org.springframework.util.StringUtils;
|
37 | 40 |
|
@@ -95,8 +98,9 @@ public BasicPersistentEntity(TypeInformation<T> information, @Nullable Comparato
|
95 | 98 | this.associations = comparator == null ? new HashSet<>() : new TreeSet<>(new AssociationComparator<>(comparator));
|
96 | 99 |
|
97 | 100 | this.propertyCache = new ConcurrentHashMap<>();
|
98 |
| - this.annotationCache = new ConcurrentReferenceHashMap<>(); |
99 |
| - this.propertyAnnotationCache = CollectionUtils.toMultiValueMap(new ConcurrentReferenceHashMap<>()); |
| 101 | + this.annotationCache = new ConcurrentReferenceHashMap<>(16, ReferenceType.WEAK); |
| 102 | + this.propertyAnnotationCache = CollectionUtils |
| 103 | + .toMultiValueMap(new ConcurrentReferenceHashMap<>(16, ReferenceType.WEAK)); |
100 | 104 | this.propertyAccessorFactory = BeanWrapperPropertyAccessorFactory.INSTANCE;
|
101 | 105 | this.typeAlias = Lazy.of(() -> getAliasFromAnnotation(getType()));
|
102 | 106 | }
|
|
0 commit comments