mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Ignore JUnit annotations when caching test contexts
Update `ImportsContextCustomizer` to ignore JUnit annotations. See gh-28563
This commit is contained in:
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…
Reference in New Issue
Block a user