Skip to content

Commit 89e7616

Browse files
drow724fmbenhassine
authored andcommitted
Add default component name in constructor of AvroItemReader
Issue #4285
1 parent 2cc0be4 commit 89e7616

File tree

1 file changed

+7
-1
lines changed
  • spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro

1 file changed

+7
-1
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/avro/AvroItemReader.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 the original author or authors.
2+
* Copyright 2019-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,13 +35,15 @@
3535
import org.springframework.core.io.Resource;
3636
import org.springframework.lang.Nullable;
3737
import org.springframework.util.Assert;
38+
import org.springframework.util.ClassUtils;
3839

3940
/**
4041
* An {@link ItemReader} that deserializes data from a {@link Resource} containing
4142
* serialized Avro objects.
4243
*
4344
* @author David Turanski
4445
* @author Mahmoud Ben Hassine
46+
* @author Song JaeGeun
4547
* @since 4.2
4648
*/
4749
public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<T> {
@@ -61,6 +63,8 @@ public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<
6163
* @param clazz the data type to be deserialized.
6264
*/
6365
public AvroItemReader(Resource resource, Class<T> clazz) {
66+
setName(ClassUtils.getShortName(AvroItemReader.class));
67+
6468
Assert.notNull(resource, "'resource' is required.");
6569
Assert.notNull(clazz, "'class' is required.");
6670

@@ -78,6 +82,8 @@ public AvroItemReader(Resource resource, Class<T> clazz) {
7882
* @param schema the {@link Resource} containing the Avro schema.
7983
*/
8084
public AvroItemReader(Resource data, Resource schema) {
85+
setName(ClassUtils.getShortName(AvroItemReader.class));
86+
8187
Assert.notNull(data, "'data' is required.");
8288
Assert.state(data.exists(), "'data' " + data.getFilename() + " does not exist.");
8389
Assert.notNull(schema, "'schema' is required");

0 commit comments

Comments
 (0)