首页 > 解决方案 > Spring Batch multiple DataSourcees

问题描述

In Spring Batch, I can inject a DataSource in

@Configuration
public class DbConfiguration {
    ....
    @Autowired
    public DataSource dataSource;

With a bunch of properties in my Application.properties

spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/learning_spring_batch
spring.datasource.username=root
spring.datasource.password=waterside
spring.datasource.platform=mysql
spring.datasource.continueOnError=false

What happens if I want multiple Datasources?

For example, 1 for my source, 1 for my target and 1 for my Spring batch tables, is that possible? Also, if I want to specify specific schemas for any of the Datasources how do I do that? Thanks

标签: spring-bootspring-dataspring-batchspring-batch-admin

解决方案


推荐阅读