In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-11-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Summary of Spring-Batch Learning (3)-- how to enter data
I. Overview of ItemReader
1.ItemReader: the interface that provides data
two。 There is only one method read () in this interface, which reads one data and moves to the next, and must return a null at the end of the reading, otherwise it indicates that the data has not finished reading.
Example:
OverViewApplication:
Package com.dhcc.batch.batchDemo.input.overview;import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@EnableBatchProcessingpublic class OverViewApplication {public static void main (String [] args) {SpringApplication.run (OverViewApplication.class, args);}}
InputOverViewDemoJobConfiguration:
Package com.dhcc.batch.batchDemo.input.overview;import java.util.Arrays;import java.util.List;import org.springframework.batch.core.Job;import org.springframework.batch.core.Step;import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;import org.springframework.batch.item.ItemWriter;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration @ Configurationpublic class InputOverViewDemoJobConfiguration {@ Autowired private JobBuilderFactory jobBuilderFactory; @ Autowired private StepBuilderFactory stepBuilderFactory; @ Bean public Job inputOverViewDemoJob () {return jobBuilderFactory.get ("inputOverViewDemoJob") .start (inputOverViewDemoJobStep ()). Build ();} public Step inputOverViewDemoJobStep () {return stepBuilderFactory.get ("inputOverViewDemoJobStep"). Chunk (2) .reader (inputOverViewDemoReader ()) .writer (outputOverViewDemoWriter ()). Build () } private ItemWriter 4.0.0 com.dhcc.batch batchDemo 0.0.1-SNAPSHOT jar batchDemo Demo project for Spring Boot org.springframework.boot spring-boot-starter-parent 2.0.4.RELEASE UTF-8 UTF-8 1.8 org.springframework.boot spring -boot-starter-batch org.springframework.boot spring-boot-starter-test test org.springframework.batch spring-batch-test test org.springframework spring-oxm 5.0.8.RELEASE Com.thoughtworks.xstream xstream 1.4.10 org.springframework.boot spring-boot-starter-jdbc mysql mysql-connector-java runtime Org.springframework.boot spring-boot-maven-plugin
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.