在@Test 中測試方法是報錯
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.ztes.demo.dao.AreaDaoTest': Unsatisfied dependency expressed through field 'areaDao'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ztes.demo.dao.AreaDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}?
測試報這樣的錯什么原因????請高手幫忙回答下。謝謝?。?!
2018-03-06
同學好,請確保你的package設置正確,com.ztes.demo.dao.AreaDao,我看截圖里是com.imooc.demo.dao.AreaDao...
2020-07-23
-_-||-_-||-_-||-_-||-_-||-_-||-_-||-_-||加了@mapper 或者@repostory也不行,加了@Mapper public interface AreaDao{ }也不行? 就是報錯。。
2020-03-02
我也是,加了@mapper 或者@repostory也不行
2019-08-23
mapperscan的包路徑改到.demo就不報錯了
2018-12-22
視頻示例有誤,沒有使用@Mapper,所以無法被掃描到,自然就沒實例化,應在public前加上:
@Mapper
public interface AreaDao{
}
2018-03-06
我在網上查的這個問題的原因是接口無法被實例化到spring容器中,但是不知道怎么解決它
2018-03-06
報名可以任意起啊,不一定非用imooc啊,謝謝