MyBatis通过xml文件配置DAO层Mapper出错

图片说明
图片说明
图片说明
图片说明
我把xml放在相同路径下,并且xml文件的名称也相同,就是出错,有谁知道这个么?万分感激!

#mybatis.mapper-locations= classpath:config/*.xml 注释掉这行代码时,启动时项目也会报Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

后面分别加上mapperr ,就是dao的名字是NewsDaoMapper 映射文件是NewsDaoMapper.xml这样试试

你怎么又在用注解sql,又用mapper文件编写sql。看看你的mapper.xml文件和dao层接口扫描到没有。把dao层接口的注解换成@repository呢。

看下你application.properties 的配置mybatis.mapper-locations= 这个是扫描你mapper.xml配置路径

图片说明