Browse Source

AbstractApplicationContext clears ReflectionUtils cache as well

Issue: SPR-13783
pull/934/head
Juergen Hoeller 10 years ago
parent
commit
fdc14a16ee
  1. 7
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  2. 9
      spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

7
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -77,6 +77,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @@ -77,6 +77,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
/**
* Abstract implementation of the {@link org.springframework.context.ApplicationContext}
@ -867,13 +868,15 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader @@ -867,13 +868,15 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
}
/**
* Reset Spring's common core caches, in particular the {@link ResolvableType}
* and the {@link CachedIntrospectionResults} caches.
* Reset Spring's common core caches, in particular the {@link ReflectionUtils},
* {@link ResolvableType} and {@link CachedIntrospectionResults} caches.
* @since 4.2
* @see ReflectionUtils#clearCache()
* @see ResolvableType#clearCache()
* @see CachedIntrospectionResults#clearClassLoader(ClassLoader)
*/
protected void resetCommonCaches() {
ReflectionUtils.clearCache();
ResolvableType.clearCache();
CachedIntrospectionResults.clearClassLoader(getClassLoader());
}

9
spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

@ -739,6 +739,15 @@ public abstract class ReflectionUtils { @@ -739,6 +739,15 @@ public abstract class ReflectionUtils {
}, COPYABLE_FIELDS);
}
/**
* Clear the internal method/field cache.
* @since 4.2.4
*/
public static void clearCache() {
declaredMethodsCache.clear();
declaredFieldsCache.clear();
}
/**
* Action to take on each method.

Loading…
Cancel
Save