You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@BeforeStep/@AfterStep methods are ignored by ChunkOrientedStepBuilder#listener(Object) #5451
I searched existing issues and found related listener-registration issues such as #5092, #5094, and #5347, but I could not find a duplicate for this specific case.
Bug description
ChunkOrientedStepBuilder#listener(Object) ignores annotation-based listeners that only declare @BeforeStep or @AfterStep methods.
The same object is registered if it also has another chunk/item listener annotation, such as @BeforeRead.
Environment
Spring Batch: 6.0.4
Java: 21
Steps to reproduce
Register a POJO with only a step-level listener annotation on a chunk-oriented step:
The root cause looks self-contained: ChunkOrientedStepBuilder#listener(Object) scans for the chunk/item annotations (@BeforeChunk, @BeforeRead, @BeforeWrite, …) but not for the step-level @BeforeStep/@AfterStep, so a POJO declaring only those produces an empty method set and is never registered. StepBuilderHelper#listener(Object) already handles them (it adds BeforeStep.class/AfterStep.class to its scan), so this seems to be an inconsistency introduced by the new builder rather than an intentional change.
If a fix is welcome, I'd add the two missing annotations to the scan and cover it with a regression test based on the reporter's reproducer.
Activity
seonwooj0810 commentedon Jul 15, 2026
Would the team be open to a PR for this?
The root cause looks self-contained:
ChunkOrientedStepBuilder#listener(Object)scans for the chunk/item annotations (@BeforeChunk,@BeforeRead,@BeforeWrite, …) but not for the step-level@BeforeStep/@AfterStep, so a POJO declaring only those produces an empty method set and is never registered.StepBuilderHelper#listener(Object)already handles them (it addsBeforeStep.class/AfterStep.classto its scan), so this seems to be an inconsistency introduced by the new builder rather than an intentional change.If a fix is welcome, I'd add the two missing annotations to the scan and cover it with a regression test based on the reporter's reproducer.
fmbenhassine commentedon Aug 26, 2026
Resolved with fa9ad1b.
AGENTS.md의 리스너 등록 위치 규칙을 배치 6.0.6 기준으로 고쳤다