|
@@ -1,15 +1,14 @@
|
|
|
package com.zswl.cloud.springBtach.server.core.controller;
|
|
|
|
|
|
-import com.zswl.cloud.springBatch.cline.enhance.EnhanceStepBuilderFactory;
|
|
|
import com.zswl.cloud.springBtach.server.core.service.JobService;
|
|
|
import org.springframework.batch.core.ExitStatus;
|
|
|
import org.springframework.batch.core.Step;
|
|
|
import org.springframework.batch.core.StepContribution;
|
|
|
+import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
|
|
import org.springframework.batch.core.job.SimpleJob;
|
|
|
import org.springframework.batch.core.scope.context.ChunkContext;
|
|
|
import org.springframework.batch.core.step.tasklet.Tasklet;
|
|
|
import org.springframework.batch.repeat.RepeatStatus;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@@ -26,7 +25,7 @@ public class TestSpringBatch {
|
|
|
private JobService jobService;
|
|
|
|
|
|
@Resource
|
|
|
- private EnhanceStepBuilderFactory stepBuilderFactory;
|
|
|
+ private StepBuilderFactory stepBuilderFactory;
|
|
|
|
|
|
@GetMapping("/job/order")
|
|
|
public ExitStatus startJob1(String name) throws Exception {
|
|
@@ -38,17 +37,6 @@ public class TestSpringBatch {
|
|
|
return jobService.channelOrderBatch(name);
|
|
|
}
|
|
|
|
|
|
- @Bean
|
|
|
- public Tasklet tasklet() {
|
|
|
- return new Tasklet() {
|
|
|
- @Override
|
|
|
- public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
|
|
- System.out.println("----------------taskletA---------------" + chunkContext.getStepContext().getJobParameters().get("name"));
|
|
|
- return RepeatStatus.FINISHED;
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
public Step stepA(){
|
|
|
//tasklet 执行step逻辑, 类似 Thread()--->可以执行runable接口
|
|
|
return stepBuilderFactory.get("stepA")
|