Skip to content

Commit 23876d8

Browse files
ledoyenphilwebb
authored andcommitted
Ignore JUnit annotations when caching test contexts
Update `ImportsContextCustomizer` to ignore JUnit annotations. See gh-28563
1 parent e802d6b commit 23876d8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ static class ContextCustomizerKey {
222222
filters.add(new JavaLangAnnotationFilter());
223223
filters.add(new KotlinAnnotationFilter());
224224
filters.add(new SpockAnnotationFilter());
225+
filters.add(new JunitAnnotationFilter());
225226
ANNOTATION_FILTERS = Collections.unmodifiableSet(filters);
226227
}
227228

@@ -384,4 +385,15 @@ public boolean isIgnored(Annotation annotation) {
384385

385386
}
386387

388+
/**
389+
* {@link AnnotationFilter} for Spock annotations.
390+
*/
391+
private static final class JunitAnnotationFilter implements AnnotationFilter {
392+
393+
@Override
394+
public boolean isIgnored(Annotation annotation) {
395+
return annotation.annotationType().getName().startsWith("org.junit.");
396+
}
397+
398+
}
387399
}

0 commit comments

Comments
 (0)