File tree 5 files changed +12
-8
lines changed
spring-context/src/main/java/org/springframework/context/support
spring-core/src/main/java/org/springframework/core/annotation
5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1083,6 +1083,9 @@ protected void doClose() {
1083
1083
// Let subclasses do some final clean-up if they wish...
1084
1084
onClose ();
1085
1085
1086
+ // Reset common introspection caches to avoid class reference leaks.
1087
+ resetCommonCaches ();
1088
+
1086
1089
// Reset local application listeners to pre-refresh state.
1087
1090
if (this .earlyApplicationListeners != null ) {
1088
1091
this .applicationListeners .clear ();
Original file line number Diff line number Diff line change @@ -1321,6 +1321,9 @@ public static boolean isSynthesizedAnnotation(@Nullable Annotation annotation) {
1321
1321
public static void clearCache () {
1322
1322
AnnotationTypeMappings .clearCache ();
1323
1323
AnnotationsScanner .clearCache ();
1324
+ AttributeMethods .cache .clear ();
1325
+ RepeatableContainers .cache .clear ();
1326
+ OrderUtils .orderCache .clear ();
1324
1327
}
1325
1328
1326
1329
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -39,9 +39,7 @@ final class AttributeMethods {
39
39
40
40
static final AttributeMethods NONE = new AttributeMethods (null , new Method [0 ]);
41
41
42
-
43
- private static final Map <Class <? extends Annotation >, AttributeMethods > cache =
44
- new ConcurrentReferenceHashMap <>();
42
+ static final Map <Class <? extends Annotation >, AttributeMethods > cache = new ConcurrentReferenceHashMap <>();
45
43
46
44
private static final Comparator <Method > methodComparator = (m1 , m2 ) -> {
47
45
if (m1 != null && m2 != null ) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public abstract class OrderUtils {
41
41
private static final String JAVAX_PRIORITY_ANNOTATION = "javax.annotation.Priority" ;
42
42
43
43
/** Cache for @Order value (or NOT_ANNOTATED marker) per Class. */
44
- private static final Map <AnnotatedElement , Object > orderCache = new ConcurrentReferenceHashMap <>(64 );
44
+ static final Map <AnnotatedElement , Object > orderCache = new ConcurrentReferenceHashMap <>(64 );
45
45
46
46
47
47
/**
Original file line number Diff line number Diff line change 43
43
*/
44
44
public abstract class RepeatableContainers {
45
45
46
+ static final Map <Class <? extends Annotation >, Object > cache = new ConcurrentReferenceHashMap <>();
47
+
46
48
@ Nullable
47
49
private final RepeatableContainers parent ;
48
50
@@ -137,8 +139,6 @@ public static RepeatableContainers none() {
137
139
*/
138
140
private static class StandardRepeatableContainers extends RepeatableContainers {
139
141
140
- private static final Map <Class <? extends Annotation >, Object > cache = new ConcurrentReferenceHashMap <>();
141
-
142
142
private static final Object NONE = new Object ();
143
143
144
144
private static StandardRepeatableContainers INSTANCE = new StandardRepeatableContainers ();
You can’t perform that action at this time.
0 commit comments