Could not autowire. No beans of 'DeptDao' type found

对于IDEA这个提示功能,度娘的回答基本上空前的一致,大多数的说法都是要求我们把这个提示功能关闭,对此对于我这种非处女座却有着比处女座更胜强迫症的程序员来说,这简直不能忍?????

Could not autowire. No beans of 'DeptDao' type found_第1张图片

 

 

多说都是废话,解决方法
方法1:在mapper文件上加@Repository注解,这是从spring2.0新增的一个注解,用于简化 Spring 的开发,实现数据访问

Could not autowire. No beans of 'DeptDao' type found_第2张图片

Could not autowire. No beans of 'DeptDao' type found_第3张图片

 

方法2:在mapper文件上加@Component注解,把普通pojo实例化到spring容器中,相当于配置文件中的

Could not autowire. No beans of 'DeptDao' type found_第4张图片

 

Could not autowire. No beans of 'DeptDao' type found_第5张图片

 

对于其他的@Service @Controller该加在什么类上就不需要我这个菜鸡来阐明了吧?O(∩_∩)O哈哈~

 

 


 

 

你可能感兴趣的:(springcloud)