Use constructor injection for StoredProcedureItemReader
ProprietarySpring 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. MigrateStoredProcedureItemReaderConstructormod run . --recipe= io. moderne. java. spring. batch. MigrateStoredProcedureItemReaderConstructorInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.