From bc07a54075f540240791311e1276222450589802 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sat, 31 Mar 2018 23:08:30 +0200 Subject: [PATCH] Clear AnnotationUtils cache after context refresh (along with others) Issue: SPR-16675 --- .../context/support/AbstractApplicationContext.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index a265d32168..4ec03e7680 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,6 +66,7 @@ import org.springframework.context.expression.StandardBeanExpressionResolver; import org.springframework.context.weaving.LoadTimeWeaverAware; import org.springframework.context.weaving.LoadTimeWeaverAwareProcessor; import org.springframework.core.ResolvableType; +import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.Environment; @@ -900,15 +901,18 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader } /** - * Reset Spring's common core caches, in particular the {@link ReflectionUtils}, - * {@link ResolvableType} and {@link CachedIntrospectionResults} caches. + * Reset Spring's common reflection metadata caches, in particular the + * {@link ReflectionUtils}, {@link AnnotationUtils}, {@link ResolvableType} + * and {@link CachedIntrospectionResults} caches. * @since 4.2 * @see ReflectionUtils#clearCache() + * @see AnnotationUtils#clearCache() * @see ResolvableType#clearCache() * @see CachedIntrospectionResults#clearClassLoader(ClassLoader) */ protected void resetCommonCaches() { ReflectionUtils.clearCache(); + AnnotationUtils.clearCache(); ResolvableType.clearCache(); CachedIntrospectionResults.clearClassLoader(getClassLoader()); }