============== 坑1 :idea不认识 @Autowired =========================================
idea这个工具 有时候不认识 @Autowired 这个注解。什么时候呢?
就是在 ServiceImpl 实现类中 想注入 Dao 对象的时候。Dao对象上直接用@Autowired会报错
解决方法一:沿着这个 Settings - Editor - Inspections - Spring - Spring Core - Code - Autowiring for Bean Class
将提示等级 降为 “Warning”。
解决方法二:用@Resource注解 代替。
=============== 坑2: Mapper.xml 注意写上 ===================
Dao接口上写了 @Mapper 后 ,就要看看
这个.xml里的内容有没有写全。 是规定要先写好内容的。
【idea中创建springMVC项目的2个坑】不识别@Autowired 以及 Mapper.xml的配置
原文:https://www.cnblogs.com/raphaelJava-4560/p/13275064.html