CallableTaskletAdapter Spring批处理

CallableTaskletAdapter Spring批处理,spring,spring-boot,spring-batch,batch-processing,Spring,Spring Boot,Spring Batch,Batch Processing,CallableTaskletAdapter使用的线程是否与步骤本身不同 @Bean public Callable<RepeatStatus> callableObject() { return () -> { System.out.println(Thread.currentThread().getName()); System.out.println("This was executed i

CallableTaskletAdapter使用的线程是否与步骤本身不同

    @Bean
    public Callable<RepeatStatus> callableObject() {

        return () -> {
            System.out.println(Thread.currentThread().getName());
            System.out.println("This was executed in another thread");

            return RepeatStatus.FINISHED;
        };
    }

    @Bean
    public CallableTaskletAdapter tasklet() {
        CallableTaskletAdapter callableTaskletAdapter =new CallableTaskletAdapter();

        callableTaskletAdapter.setCallable(callableObject());

        return callableTaskletAdapter;
    }
@Bean
    public Step callableStep() {
        System.out.println(Thread.currentThread().getName());
        return this.stepBuilderFactory.get("callableStep")
                .tasklet(tasklet())
                .build();
    }
@Bean
公共可调用callableObject(){
返回()->{
System.out.println(Thread.currentThread().getName());
System.out.println(“这是在另一个线程中执行的”);
返回RepeatStatus.FINISHED;
};
}
@豆子
public CallableTaskletAdapter tasklet(){
CallableTaskletAdapter CallableTaskletAdapter=新CallableTaskletAdapter();
setCallable(callableObject());
返回callableTaskletAdapter;
}
@豆子
公共步骤callableStep(){
System.out.println(Thread.currentThread().getName());
返回此.stepBuilderFactory.get(“callableStep”)
.tasklet(tasklet())
.build();
}
运行此代码将可调用tasklet中的线程名称打印为“main”。这意味着它没有使用新线程。我错过什么了吗

CallableTaskletAdapter使用的线程是否与步骤本身不同

    @Bean
    public Callable<RepeatStatus> callableObject() {

        return () -> {
            System.out.println(Thread.currentThread().getName());
            System.out.println("This was executed in another thread");

            return RepeatStatus.FINISHED;
        };
    }

    @Bean
    public CallableTaskletAdapter tasklet() {
        CallableTaskletAdapter callableTaskletAdapter =new CallableTaskletAdapter();

        callableTaskletAdapter.setCallable(callableObject());

        return callableTaskletAdapter;
    }
@Bean
    public Step callableStep() {
        System.out.println(Thread.currentThread().getName());
        return this.stepBuilderFactory.get("callableStep")
                .tasklet(tasklet())
                .build();
    }
不,它不使用单独的线程。它使用执行tasklet的线程
Callable#call