0

I want to convert an existing spring-boot application into a spring-boot + spring-batch application. This application should use a separate data source for spring-batch connecting to a separate database. Existing application uses application.properties file and I added several batch specific

spring.batch.datasource.*

properties to application.properties file and configured to use it in my bean definitions like these.

@Bean(name = "batchDataSource")
@ConfigurationProperties(prefix = "batch")
public DataSource batchDataSource() {
    return DataSourceBuilder.create().build();
}

I guess I am not doing it in the right way and looking forward to integrate spring-batch which uses a separate data source for spring-batch meta data. Any suggestions on how best we can do this integration in existing spring-boot application?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
gcpdev-guy
  • 460
  • 1
  • 10
  • 23
  • 1
    what you should do is configure datasources separately manually. Search for how to configure multiple datasources in springboot. There are many articles regarding this already – pvpkiran Dec 26 '17 at 21:44
  • 1
    Possible duplicate of [Use of multiple DataSources in Spring Batch](https://stackoverflow.com/questions/25540502/use-of-multiple-datasources-in-spring-batch) – Michael Minella Dec 26 '17 at 22:27
  • @MichaelMinella Do you think that documentation should be part of spring-batch documentation since most of the people use the batch schema as a different from their business schema? – gcpdev-guy Jan 03 '18 at 18:30

0 Answers0