@Autowired报错 问题原因:原因在于DAO接口添加的@Mapper并不是Spring的注解,而是ibatis的注解,并没有声明这个DAO接口作为Spring的Bean,因此Spring不能进行管理,导致注入报错。 解决方法:在相应的Mapper或dao类(接口)加入@Component或@Repository。