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

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

如果说出现这个问题得时候,向服务断发送请求得时候并没有报错,这Idea自身得毛病,不用管!有得时候就怕是其他得错误,然而归咎于 Could not autowire. No beans of 'UserDao' type found. 它,那就很头痛了,

比如:

 Could not autowire. No beans of 'UserDao' type found. 错误个人见解

现在启动并没有报错,感觉一切正常,然而访问的时候

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

报错了?????????

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

就会误以为是 @Autowired注解引起的

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

这两者之间的不匹配导致的!

再出现一个异常

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

这是因为在mapper.xml文件里面配置的时候 <resultMap></resultMap>标签里面的

<id     column="id"     property="iD"   jdbcType="INTEGER" /> property属性与实体类里面的id名称不对应所导致的!!

也就是说,当遇到这个问题的时候,访问是能够正常,如果出现异常,就不纠结是这个问题,也许是其他地方的原因!!

也许例子不怎么恰当!广收大量的异常!清者自清,浊者自浊!

如果说你用这个注解出现这个问题,那就换一个注解  @Resource  位于  import javax.annotation.Resource; 包下 

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

就不会出现这个提醒,启动也不会报错,访问也将正常

Could not autowire. No beans of 'UserDao' type found. 错误个人见解

       一个剑客,老是喜欢和别人切磋剑术,然而他输的时候很多,100回输了90回,虽然输了,不曾放弃,却不断的寻找比人的破绽,渐渐地和太多的人切磋,他也成为了高手,因为他知道了太多剑客的破绽,虽然输的时候多,提升了自己,就怕那一天,他想放弃比剑了,自己就不知道如何战胜比人了!


相关文章:

  • 2021-08-11
  • 2021-04-25
  • 2021-08-27
  • 2021-06-04
  • 2021-07-13
猜你喜欢
  • 2021-07-04
  • 2021-09-25
  • 2021-06-14
  • 2021-11-22
  • 2021-05-31
  • 2021-06-29
相关资源
相似解决方案