Ignore JUnit annotations when caching test contexts

Update `ImportsContextCustomizer` to ignore JUnit annotations.

See gh-28563
2.4.x
Loïc Ledoyen 3 years ago committed by Phillip Webb
parent e802d6b102
commit 23876d8a32

@ -222,6 +222,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
filters.add(new JavaLangAnnotationFilter()); filters.add(new JavaLangAnnotationFilter());
filters.add(new KotlinAnnotationFilter()); filters.add(new KotlinAnnotationFilter());
filters.add(new SpockAnnotationFilter()); filters.add(new SpockAnnotationFilter());
filters.add(new JunitAnnotationFilter());
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters); ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
} }
@ -384,4 +385,15 @@ class ImportsContextCustomizer implements ContextCustomizer {
} }
/**
* {@link AnnotationFilter} for Spock annotations.
*/
private static final class JunitAnnotationFilter implements AnnotationFilter {
@Override
public boolean isIgnored(Annotation annotation) {
return annotation.annotationType().getName().startsWith("org.junit.");
}
}
} }

Loading…
Cancel
Save