I am trying to setup multiple data sources(MySql, Postgres & Oracle) using Spring boot. I am not using JPA. Setting up with a JdbcTemplate.
I have tried setting
My setup: spring-boot version 1.2.5.RELEASE
I succeeded in running a setup like this, with the jdbc being created with the correct DataSources by adding a @Qualifier in each JDBC method creation
So, for every JDBC method you should match the qualifying datasource like this
@Bean(name = "dJdbc")
public JdbcTemplate drupalJdbcTemplate(@Qualifier("dMySql") DataSource dMySql) {
return new JdbcTemplate(dMySql);
}
No matter you choose for @Primary, using the @Qualifier for every JDBC should work good. Autowiring jdbcTemplates in repositories, and using @Qualifier for them is ok also.