spring-projects / spring-projects/spring-batch
ItemStreamSupport could implement BeanNameAware [BATCH-2108]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
Jimmy Praet opened BATCH-2108 and commented
ItemStreamSupport has a setName() method to configure the name of the component, which will also be used as a prefix for the keys stored in the step execution context.
If ItemStreamSupport were to implement BeanNameAware this name could be set automatically by default to the bean id.
This has the added benefit that the name setter is exposed via an interface instead of via a public method on an abstract class. I mention this because in my projects I have a delegating writer where I want to propagate the name property to the delegate as follows:
@Override
public void setName(String name) {
super.setName(name);
if (delegate instanceof AbstractItemStreamItemWriter) {
((AbstractItemStreamItemWriter<?>) delegate).setName(name);
}
}
However, this does not work if the delegate is a JDK dynamic proxy step scoped bean, because it won't be an instanceof AbstractItemStreamItemWriter.
Referenced from: pull request https://github.com/spring-projects/spring-batch/pull/292
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate ItemStreamSupport and the surrounding Spring Batch item-stream classes, then review the referenced pull request for prior work. Check how the component name is currently configured and how bean-name awareness would affect step execution context keys; done means the bean id supplies the name by default without breaking explicit naming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100