When i define more than one datasource in my spring cloud task application , it throws an exception. This is how i have defined the datasources
@Primary
@Bean(name="datasource1")
@ConfigurationProperties(prefix="spring.datasource")
public javax.sql.DataSource primaryDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name="datasource2")
@ConfigurationProperties(prefix="spring.datasource1")
public javax.sql.DataSource primaryDataSource1() {
return DataSourceBuilder.create().build();
}
@Bean
public TaskConfigurer taskConfigurer() {
return new DefaultTaskConfigurer(primaryDataSource());
}
I have seen suggestions to put @Primary , defining TaskConfigurer like above, but none of them is working.Has any one faced this kind of problem ?
Thanks, Neel