Open magno32 opened 9 years ago
Would manually setting the JdbcTemplate
in the subclass constructor work?
@Repository
public class UserRepository extends JdbcRepository<User, String> {
@Autowired
public UserRepository(@Qualifier("secondaryDataSource") DataSource dataSource){
super(...);
this.setJdbcOperations(new JdbcTemplate(dataSource));
}
....
}
I agree that this is not ideal, though. It'd be nice if there were another way to set the data source.
The BeanFactory in JdbcRepository always grabs the default DataSource. This prevents an application from using more than one datasource.
Also
Clears the jdbc template created by a child class, i.e. Child Class
is overwritten immediately.