Hi
I have two defined two datasources:
<beans ... default-autowire="byType">
...
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource" name="dataSource"> ...
<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSourceXXX" name="dataSourceXXX"> ...
and want to inject one of them in an annotated StoredProcedure:
@Component
@Scope("prototype")
public class AddTrialProcedure extends StoredProcedure{
@Autowired
public AddTrialProcedure(@Qualifier("dataSource") DataSource dataSource) {
But Spring ignores @Qualifier and instead throws me an error on startup:
NoSuchBeanDefinitionException: No unique bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 2: [dataSource, dataSourceTrialpedia]
Where is the mistake?
Spring version is 3.1.2.RELEASE


Reply With Quote
