JdBcPagingItemReader fails with Null NamedJdbcParameter for Step Configuration

I am attempting to create a simple Step for a batch process which takes ProductDetail information and other information from the item processor to create and write the new ProductResult to a Mongodb database. I am attempting to use a JdbcPagingItemReader for reading the data from a database. However, when I start the job it fails with an error

java.lang.NullPointerException: Cannot invoke “org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.getJdbcOperations()” because “this.namedParameterJdbcTemplate” is null. I also tested this with another reader and it works, so it is only the JdbcPagingItemReader that’s the issue.

I don’t know why the NamedParameterJdbcTemplate is needed since I have provided the select and from values and a configured row mapper.

Here is my code


    import com.datacom.mapper.ProductDetailRowMapper;
    import com.datacom.model.ProductDetail;
    import lombok.RequiredArgsConstructor;
    import org.springframework.batch.core.Step;
    import org.springframework.batch.core.repository.JobRepository;
    import org.springframework.batch.core.step.builder.StepBuilder;
    import org.springframework.batch.item.ItemStreamReader;
    import org.springframework.batch.item.ItemWriter;
    import org.springframework.batch.item.data.MongoItemWriter;
    import org.springframework.batch.item.data.builder.MongoItemWriterBuilder;
    import org.springframework.batch.item.database.JdbcPagingItemReader;
    import org.springframework.batch.item.database.Order;
    import org.springframework.batch.item.database.support.OraclePagingQueryProvider;
    import org.springframework.beans.factory.annotation.Qualifier;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.data.mongodb.core.MongoOperations;
    import org.springframework.transaction.PlatformTransactionManager;
    
    import javax.sql.DataSource;
    import java.util.HashMap;
    import java.util.Map;
    
    @Configuration
    @RequiredArgsConstructor
    public class ProductDetailConfigStep {
    
        @Value("${db.pageSize}")
        int pageSize;
    
        final MongoOperations mongoOperations;
    
        final @Qualifier("productsDataSource") DataSource dataSource;
    
        final PlatformTransactionManager transactionManager;
    
    
        final JobRepository jobRepository;
    
        @Value("${batch.chunkSize}") int chunkSize;
    
        final ProductResultProcessor productResultProcessor;
    
        public ItemStreamReader<ProductDetail> itemReader() {
            JdbcPagingItemReader<ProductDetail> itemReader = new JdbcPagingItemReader<>();
            itemReader.setDataSource(productsDataSource);
            itemReader.setFetchSize(chunkSize);
            OraclePagingQueryProvider queryProvider = new OraclePagingQueryProvider();
            queryProvider.setSelectClause(JDBCConstants.SELECT_QUERY);
            queryProvider.setFromClause(JDBCConstants.FROM_CLAUSE_QUERY);
            itemReader.setRowMapper(new ProductDetailRowMapper());
            final Map<String, Order> sortKeys = new HashMap<>();
            itemReader.setParameterValues(new HashMap<>());
            sortKeys.put("product_id", Order.ASCENDING);
            queryProvider.setSortKeys(sortKeys);
            itemReader.setQueryProvider(queryProvider);
            itemReader.setPageSize(pageSize);
            itemReader.setPageSize(chunkSize);
            return itemReader;
        }
    
        public ItemWriter<ProductResult> itemWriter() {
            var writer = new MongoItemWriterBuilder<ProductResult>()
                    .collection(Documents.PRODUCT_CATALOG_COLLECTION)
                    .mode(MongoItemWriter.Mode.INSERT)
                    .template(mongoOperations)
                    .build();
            writer.setTemplate(mongoOperations);
            return writer;
        }
    
        @Bean("productProcessingDetailStep")
        public Step productProcessingDetailStep() {
            return new StepBuilder("productCreationStep", jobRepository)
                    .<ProductDetail, ProductResult>chunk(chunkSize, transactionManager)
                    .reader(itemReader())
                    .processor(productResultProcessor)
                    .writer(itemWriter())
                    .build();
        }
    }

What am I missing the configuration of the JdbcPagingItemReader looks fine to me.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật