From d9bbb0ecda8c918ec4071a45865f5c4daf842225 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 2 Mar 2019 12:30:06 +0100 Subject: [PATCH] Simplify BatchTestContextCustomizerFactory Since @SpringBatchTest is effectively a marker annotation from the perspective of BatchTestContextCustomizerFactory, there is no need to retrieve the merged, synthesized annotation. Checking for the presence of @SpringBatchTest is sufficient. --- .../batch/test/context/BatchTestContextCustomizerFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-batch-test/src/main/java/org/springframework/batch/test/context/BatchTestContextCustomizerFactory.java b/spring-batch-test/src/main/java/org/springframework/batch/test/context/BatchTestContextCustomizerFactory.java index 645ca5b37..f5f5cfc72 100644 --- a/spring-batch-test/src/main/java/org/springframework/batch/test/context/BatchTestContextCustomizerFactory.java +++ b/spring-batch-test/src/main/java/org/springframework/batch/test/context/BatchTestContextCustomizerFactory.java @@ -32,8 +32,7 @@ public class BatchTestContextCustomizerFactory implements ContextCustomizerFacto @Override public ContextCustomizer createContextCustomizer(Class testClass, List configAttributes) { - SpringBatchTest springBatchTest = AnnotatedElementUtils.findMergedAnnotation(testClass, SpringBatchTest.class); - if (springBatchTest != null) { + if (AnnotatedElementUtils.hasAnnotation(testClass, SpringBatchTest.class)) { return new BatchTestContextCustomizer(); } return null;