Skip to content

Regression in AbstractBatchConfiguration for dataSource Autowiring [BATCH-2819] #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Apr 24, 2019 · 3 comments

Comments

@spring-projects-issues
Copy link
Collaborator

Jean-Francois Larouche opened BATCH-2819 and commented

Hi,

This commit: 

7a9a2a9#diff-03a06349c3e7d9dcf99d6433a1d565db

When providing our own BatchConfigurer and wiring up the DastaSource correctly, this add a regression when none of the dataSource bean are @Primary. Because the SimpleBatchConfigurer is always created.

Would it not have been possible to iterate through the Collection inside getConfigurer(...) and just use the DataSource that have a @Primary in the list instead? This would have caused 0 regression.

Thanks.

New Error:

Field dataSource in org.springframework.batch.core.configuration.annotation.AbstractBatchConfiguration required a single bean, but 2 were found:Field dataSource in org.springframework.batch.core.configuration.annotation.AbstractBatchConfiguration required a single bean, but 2 were found: - batchDataSource: defined by method 'batchDataSource' in class path resource [com/sepaq/batch/config/DataSourceBatchConfig.class] - oracleDataSource: defined by method 'oracleDataSource' in class path resource [com/sepaq/batch/jpa/datasource/DataSourceOracleConfig.class]


Affects: 4.1.1, 4.1.2

@kimehdgns
Copy link

I think that commit forces @primary annotation to be used or need bean with name "dataSource" in multiple datasource configurations. Even if I use in-memory job repository.

@fmbenhassine fmbenhassine removed the status: waiting-for-triage Issues that we did not analyse yet label Jan 21, 2021
@fmbenhassine fmbenhassine added this to the 5.0.0 milestone Jan 21, 2021
@df007df
Copy link

df007df commented Jul 28, 2022

I had the same problem, and here's how I configured it.
I want the specific dataSource can be specified.

Whether the dataSource can be injected to BatchConfigurer.
Because we are now using DefaultBatchConfigurer(dataSource) to inject the specific used.

Affects: 4.3.6

@fmbenhassine fmbenhassine modified the milestones: 5.0.0, 5.0.0-M6 Aug 31, 2022
@fmbenhassine
Copy link
Contributor

This is superseded by #3942 . The data source to use for Batch meta-data can be provided either declaratively as an attribute of @EnableBatchProcessing, or programmatically by overriding DefaultBatchConfiguration#getDataSource().

@fmbenhassine fmbenhassine removed this from the 5.0.0-M6 milestone Sep 20, 2022
@fmbenhassine fmbenhassine added the status: superseded Issues that are superseded by other issues label Sep 20, 2022
@fmbenhassine fmbenhassine closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants