My purpose is to implement custom DAO interface and that's what I do, but it seems does not work.
My interface is:
public interface AbstractDAO<T> {
void add(T object);
T load(Integer ID);
List<T> list();
void update(T object);
void delete(Integer ID);
}
And it's implementation:
@Repository
public class AccountDAO implements AbstractDAO<Account> {
@Autowired
private JdbcTemplate jdbcTemplate;
@Transactional
public void add(Account object) {
...
}
...
}
as I told, it doesn't work due Spring scanner cannot find the dao class.
How to let this work? Without implements
it works fine.
Spring scanner configuration:
<bean ...>
<context:component-scan base-package="dao" />
<context:component-scan base-package="tmp" />
<context:component-scan base-package="services" />
<context:component-scan base-package="entities" />
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven />
<tx:annotation-driven />
<task:annotation-driven />
<import resource="spring-beans.xml"/>
</bean>
Error:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [dao.AccountDAO] found for dependency: expected
at least 1 bean which qualifies as autowire candidate for this dependency