From bed4d727242de7f51803c3b25fe49c54dda231ec Mon Sep 17 00:00:00 2001 From: Taeik Lim Date: Sat, 27 Mar 2021 02:50:52 +0900 Subject: [PATCH] Add getDataSource method to DefaultBatchConfigurer --- .../annotation/DefaultBatchConfigurer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java index 4d99ddf1e5..dcae0ca49e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/DefaultBatchConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,7 @@ protected JobLauncher createJobLauncher() throws Exception { protected JobRepository createJobRepository() throws Exception { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); - factory.setDataSource(dataSource); + factory.setDataSource(getDataSource()); factory.setTransactionManager(getTransactionManager()); factory.afterPropertiesSet(); return factory.getObject(); @@ -137,8 +137,12 @@ protected JobRepository createJobRepository() throws Exception { protected JobExplorer createJobExplorer() throws Exception { JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean(); - jobExplorerFactoryBean.setDataSource(this.dataSource); + jobExplorerFactoryBean.setDataSource(getDataSource()); jobExplorerFactoryBean.afterPropertiesSet(); return jobExplorerFactoryBean.getObject(); } + + protected DataSource getDataSource() { + return dataSource; + } }