I would like to inject a specific JdbcTemplatein a Spring Boot project. I tried to follow this example for multiple DataSourceconfiguration : http:
Try to move @Qualifier annotation to the parameter on your @Bean methods for JdbcTemplate.
I guess, when you remove @Primary you end up with error, where more than one appropriate beans are presented
It should looks like this:
@Bean(name = "jdbcSlave")
@Autowired
public JdbcTemplate slaveJdbcTemplate(@Qualifier("dsSlave") DataSource dsSlave) {
return new JdbcTemplate(dsSlave);
}