【发布时间】:2012-05-21 04:21:05
【问题描述】:
在dao中使用注解
@Repository("testDao")
public class TestDaoImpl extends JdbcDaoSupport implements BaseDao{
@Override
public Object addObject(String sqlid, Object obj) {
// TODO Auto-generated method stub
return null;
}
原因:java.lang.IllegalArgumentException:需要“dataSource”或“jdbcTemplate”
我不想用:
<bean id="termsDao" class="com.manage.base.dao.impl.TestDaoImpl">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
这段代码设置在xml中,而“jdbcTemplate”已经在其他“spring-xml”中定义了。
如何通过注解解决这个问题:“'dataSource' or 'jdbcTemplate' is required”
【问题讨论】: