spring-projects / spring-projects/spring-batch

Support registrating listener with multiple interface implementation

Open
#4,633 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
A clear and concise description of what the bug is about.
When one class implements multiple listener interfaces at once, it does not get registered without dedicated annotations.

Environment
Please provide as many details as possible: Spring Batch version, Java version, which database you use if any, etc
Applicable for all versions

Steps to reproduce
Steps to reproduce the issue.
Implement one class implementing ItemReadListener, ItemProcessListener, ItemWriteListener at once.
Then, Spring Batch tries to register with SimpleStepBuilder#listener(Object listener).
However, without explicit annotations like @BeforeRead, @OnProcessError, etc., it fails to register it.

Expected behavior
A clear and concise description of what you expected to happen.
Register the listener if it's implementing one of the interfaces.

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SimpleStepBuilder#listener(Object listener) and trace how a class implementing ItemReadListener, ItemProcessListener, and ItemWriteListener is detected without annotations. First reproduce the behavior with the three interfaces, then identify the existing listener-registration tests or entry point and define done as successful registration without dedicated annotations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.