Use constructor injection for StoredProcedureItemReader

Proprietary

Spring Batch 6.0 removed the no-arg StoredProcedureItemReader() constructor and made the DataSource, procedure name and RowMapper required constructor arguments. This recipe folds setDataSource(..), setProcedureName(..) and setRowMapper(..) into the constructor (new StoredProcedureItemReader<>(dataSource, procedureName, rowMapper)) and removes those setters when the reader is created with the no-arg constructor in the same block, for both Java and Kotlin sources. Other configuration (setParameters, setPreparedStatementSetter, ...) is preserved. When the three setters cannot be safely folded, the reader is left unchanged for manual migration.

io.moderne.java.spring.batch.MigrateStoredProcedureItemReaderConstructor
mod run . --recipe=io.moderne.java.spring.batch.MigrateStoredProcedureItemReaderConstructor

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.