SpringBatch generates java.lang.IllegalArgumentException

I used Java configuration to develop a SpringBatch application. I have a class that works as a job and a main method which call the object of the job class. Further,  i used Java to configure everything, including DataSource. But, on execution i am getting exception as:

Caused by: java.lang.IllegalArgumentException: DataSource must not be null.
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:171)
    at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.getObject(AbstractJobRepositoryFactoryBean.java:202)
    at neoway.com.job.FlatFileJob.jobRepository(FlatFileJob.java:88)
    at neoway.com.job.FlatFileJob$EnhancerBySpringCGLIB$7ec3c4f6.CGLIB$jobRepository$0(
  
   )
    at neoway.com.job.FlatFileJob$EnhancerBySpringCGLIB$7ec3c4f6$FastClassBySpringCGLIB$990caa45.invoke(
   
    )
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
    at neoway.com.job.FlatFileJob$EnhancerBySpringCGLIB$7ec3c4f6.jobRepository(
    
     )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
    
   
  

Why Spring failed to recognise DataSource configuration is beyond my understanding. What is the issue?

Code :

@ComponentScan
@EnableAutoConfiguration
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Starting Spring Batch Execution -------" );
        SpringApplication.run(App.class, args);        
    }
}


@Configuration
@EnableBatchProcessing
public class FlatFileJob {

    @Autowired
    private JobBuilderFactory jobs;

    @Autowired
    private StepBuilderFactory steps;

    /**
     * Create and configure job
     * @return
     */
    @Bean(name = "Read RabbitMQ")
    public Job addFlatFileJob(){
        return jobs.get("carJob")
                .start(this.flatFileStep())
                .build();
    }

    /**
     * Create and configure the only step
     * @return
     */
    @Bean
    public Step flatFileStep(){
        return steps.get("step")
                .
  
    chunk(
   3)
                .reader(
   new CarItemReader())
                .processor(
   new CarItemProcessor())
                .writer(
   new CarItemWriter())
                .build();
    }

    @Bean
    public PlatformTransactionManager transactionManager(){
        
   return 
   new ResourcelessTransactionManager();
    }

    @Bean
    public JobRepository jobRepository() throws Exception{
        JobRepository jobRepository = (JobRepository) 
   new JobRepositoryFactoryBean();
        
   return jobRepository;
    }

    @Bean
    public JdbcTemplate jdbcTemplate(DataSource dataSource){
        
   return 
   new JdbcTemplate(dataSource);
    }

    @Bean
    public DataSource getDataSource(){
        BasicDataSource dataSource = 
   new BasicDataSource();
        dataSource.setDriverClassName(
   "org.postgresql.Driver");
        dataSource.setUrl(
   "jdbc:postgresql://127.0.0.1:5432/spring_batch");
        dataSource.setUsername(
   "xxx");
        dataSource.setPassword(
   "xxx");
        
   return dataSource;
    }
}