# springbatch **Repository Path**: xiangty1/springbatch ## Basic Information - **Project Name**: springbatch - **Description**: 这是一个SpringBoot开发的SpringBatch批处理示例,示例主要是将文件30W条数据使用多线程导入到t_cust_temp表,然后又将t_cust_temp表数据使用分片导入到t_cust_info表。下载即可用。 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 15 - **Forks**: 5 - **Created**: 2022-02-12 - **Last Updated**: 2025-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # springbatch #### 介绍 这是一个SpringBoot开发的SpringBatch批处理示例,示例主要是将文件30W条数据使用多线程导入到t_cust_temp表,然后又将t_cust_temp表数据使用分片导入到t_cust_info表。下载即可用。 注: 1.数据表SQL在 resources/sql文件夹下。 2.代码中涉及User相关的部分,是开始为看测试SpringBoot合并MyBatis使用。 #### 步骤 1.启动项目前,先找到HelloController.java类的createSpringBatchData方法是生成测试数据文件的方法。需要注意修改文件的生成路径和文件的生成条数。
注:修改的文件生成的路径还要在FlatFileItemReaderConfiguration.java类flatFileItemReader方法中,将路径改成一致的。
2.启动项目后,访问http://localhost:8002/createSpringBatchData 路径会生成测试的数据到对应的路径下。
3.访问http://localhost:8002/runJob,即可运行任务,然后查看数据库表t_cust_info表,会看到t_cust_temp表的数据到了t_cust_info表中。
注:批量的任务代码在ImportantJobNew.java中tyImportantJob方法。
4.多次测试时,需要注意,t_cust_info和t_cust_temp表中的唯一索引,所以新增过的数据,重复测试时,要记得删除,避免执行过程中出现异常。