我正在尝试使用 Spring 注释来定义控制器、服务和 dao,但失败了。
错误信息是
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.abs.absbase.ABSService] is defined: Unsatisfied dependency of type [interface com.abs.absbase.ABSService]: expected at least 1 matching bean
但我确实定义了服务。
另一个问题是,如何定义一个 sessionfactory 来覆盖 ABSDaoImpl 中的 HibernateDaoSupport ?
谢谢
源代码是
@Controller
@RequestMapping("/abs.do")
public class ABSController {
@Autowired
@Qualifier("ABSService")
ABSService service;
...
}
@Service(value="ABSService")
public class ABSServiceImpl implements ABSService {
@Autowired
@Qualifier("ABSDao")
ABSDao dao;
}
@Repository(value="ABSDao")
public class ABSDaoImpl extends HibernateDaoSupport implements ABSDao {
...
}