diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java index 8b56cb913..31af67c13 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/GroupAwareJob.java @@ -19,6 +19,7 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParametersIncrementer; import org.springframework.batch.core.JobParametersValidator; +import org.springframework.util.ClassUtils; /** * A {@link Job} that can optionally prepend a group name to another job's name, @@ -114,5 +115,10 @@ public class GroupAwareJob implements Job { public int hashCode() { return delegate.hashCode(); } + + @Override + public String toString() { + return ClassUtils.getShortName(delegate.getClass()) + ": [name=" + getName() + "]"; + } } \ No newline at end of file diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GroupAwareJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GroupAwareJobTests.java index d9e411eb0..682a96938 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GroupAwareJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/GroupAwareJobTests.java @@ -41,4 +41,9 @@ public class GroupAwareJobTests { assertEquals("jobs.foo", result.getName()); } + @Test + public void testToString() { + GroupAwareJob result = new GroupAwareJob("jobs", job); + assertEquals("JobSupport: [name=jobs.foo]", result.toString()); + } }