Spring boot + spring batch without DataSource

前端 未结 5 724
余生分开走
余生分开走 2020-12-19 00:51

I\'m trying to configure spring batch inside spring boot project and I want to use it without data source. I\'ve found that ResourcelessTransactionManager is th

5条回答
  •  醉梦人生
    2020-12-19 00:51

    I got around this problem by extending the DefaultBatchConfigurer class so that it ignores any DataSource, as a consequence it will configure a map-based JobRepository.

    Example:

    @Configuration
    @EnableBatchProcessing
    public class BatchConfig extends DefaultBatchConfigurer {   
    
        @Override
        public void setDataSource(DataSource dataSource) {
            //This BatchConfigurer ignores any DataSource
        }
    }
    

提交回复
热议问题