diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java index 48b54aa1d..f82992c25 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,14 +155,12 @@ public class AvroItemWriter extends AbstractItemStreamItemWriter { } private static DatumWriter datumWriterForClass(Class clazz) { - if (GenericRecord.class.isAssignableFrom(clazz)) { - return new GenericDatumWriter<>(); - - } if (SpecificRecordBase.class.isAssignableFrom(clazz)){ return new SpecificDatumWriter<>(clazz); } - + if (GenericRecord.class.isAssignableFrom(clazz)) { + return new GenericDatumWriter<>(); + } return new ReflectDatumWriter<>(clazz); }