This is a documentation-only issue.
After reading Registering ItemStream with a Step at https://docs.spring.io/spring-batch/reference/step/chunk-oriented-processing/registering-item-streams.html, I see that the provided example is IMO wrong.
The code example shows that implementor must register fileWriterItem1() and fileWriterItem2() as .stream because, quoted
In the preceding example, the CompositeItemWriter is not an ItemStream, but both of its delegates are
This looks inherently wrong with the actual implementation of CompositeItemWriter that indeed extends ItemStreamWriter<T>.
See also #2043, #1419 (actually a duplicate of this, cannot be reopened), #2740.
The article is indeed correct in highlighting that one must register a listener with .stream() explicitly when the handler is not detected as an ItemStream itself, but I couldn't find a viable example to contribute.
This is a documentation-only issue.
After reading
Registering ItemStream with a Stepat https://docs.spring.io/spring-batch/reference/step/chunk-oriented-processing/registering-item-streams.html, I see that the provided example is IMO wrong.The code example shows that implementor must register
fileWriterItem1()andfileWriterItem2()as.streambecause, quotedThis looks inherently wrong with the actual implementation of CompositeItemWriter that indeed extends
ItemStreamWriter<T>.See also #2043, #1419 (actually a duplicate of this, cannot be reopened), #2740.
The article is indeed correct in highlighting that one must register a listener with
.stream()explicitly when the handler is not detected as anItemStreamitself, but I couldn't find a viable example to contribute.