• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


27 Apr, 2025

Updated at 18 May, 2025

Why dosen't 'Hello World' get printed in the Spring Batch example?

Hi I am a beginner of Spring batch I am just trying to simple Hello world example

@Configuration
@RequiredArgsConstructor
public class HelloJobConfig {

    @Bean
    public Job helloJob(JobRepository jobRepository, Step helloStep1) {
        return new JobBuilder("helloJob",jobRepository)
                .start(helloStep1)
                .build();
    }
    
    
    @Bean
    public Step helloStep1(JobRepository jobRepository, Tasklet helloStep1Tasklet1, PlatformTransactionManager platformTransactionManager) {
        return new StepBuilder("helloStep1Tasklet1",jobRepository)
                .tasklet(helloStep1Tasklet1,platformTransactionManager).build();
    }
    
    @Bean
    public Tasklet helloStep1Tasklet1() {
        return ((contribution, chunkContext) -> {
            //log.info("Hello World");
            System.out.println("Hello World");
            return RepeatStatus.FINISHED;
        });
    }
    
    
}
@EnableBatchProcessing
@SpringBootApplication
public class JobApplication {

    
    public static void main(String[] args) {
        SpringApplication.run(JobApplication.class, args);
        
    }

}

spring.application.name=Job
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.username=system
spring.datasource.password=1234
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/xe
spring.batch.jdbc.initialize-schema=always
spring.batch.job.enabled=false

Here is my source code And the result is like this

Why I can't see "Hello World" in the result? Is there more configuration that needs to be add?