I am running a Spring Batch job and have two DataSource's configured like such:
@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource mainDataSource() {
return DataSourceBuilder.create().build();
}
@Bean("SpringBatchDataSource")
@ConfigurationProperties(prefix="spring.batch.datasource")
public DataSource batchDataSource() {
return DataSourceBuilder.create().build();
}
As you can see of the two DataSources I have one is just for the Spring batch metadata.
This issue I'm having is Spring batch wants to use the @Primary
DataSource
. How can I configure it to use the batchDataSource?