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.
This commit is contained in:
Sam Brannen
2019-03-02 12:30:06 +01:00
committed by Mahmoud Ben Hassine
parent 50f400cf5a
commit d9bbb0ecda

View File

@@ -32,8 +32,7 @@ public class BatchTestContextCustomizerFactory implements ContextCustomizerFacto
@Override
public ContextCustomizer createContextCustomizer(Class<?> testClass, List<ContextConfigurationAttributes> configAttributes) {
SpringBatchTest springBatchTest = AnnotatedElementUtils.findMergedAnnotation(testClass, SpringBatchTest.class);
if (springBatchTest != null) {
if (AnnotatedElementUtils.hasAnnotation(testClass, SpringBatchTest.class)) {
return new BatchTestContextCustomizer();
}
return null;