I have something like this:
class MyBean {
@Autowired
@Qualifier("jdbcTemplate")
@BeanProperty
var jdbcTemplate : JdbcTemplate = null
}
Spring complains that it can’t find a bean of type JdbcTemplate and refuses to autowire. My spring.xml has:
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="dataSource" />
</bean>
If I change the type of jdbcTemplate in MyBean from JdbcTemplate to SimpleJdbcTemplate then it works. My question is why is it apparently ignoring the Qualifier annotation? Am I doing something wrong?
It has nothing to do with
@Qualifier.SimpleJdbcTemplateis not a subclass ofJdbcTemplate, therefore it cannot be injected into a field of typeJdbcTemplate.