1
votes

I am using Spring Batch Framework in my application, in which I have successfully integrated Spring Batch Admin. When I am trying to Create bean for JdbcTemplate. it is giving me following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceInitializer': Invocation of init method failed; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 2: dataSource,phoenixDataSource

where 'dataSource' is used by Spring Batch Admin, and 'phoenixDataSource' is created by me. how do I differentiate in both, is there any way to provide @Qualifier to BatchAdmin used dataSource.

2

2 Answers

0
votes

My suggestion is that you rename phoenixDataSource to dataSource and load your application context first before the spring batch admin beans.

0
votes

An addition to @Ashish, you may use a Qualifier for referencing the datasource that you want to use.

@Qualifier("phoenixDataSource")
private Datasource datasource;

@Qualifier("phoenixDataSource")
public class PhoenixDatasource{

}