springboot整合mybatis 异常 org.apache.ibatis.binding.BindingException: Invalid bound statement ,not found:
出现异常原因: 1.IDEA 编译时,没有将mapper.xml文件编译进去
2.application.yml 文件没有指定 mapper.xml 的路径
正确配置
mybatis: mapperLocations: classpath*:club/wenfan/youtube/mapper/xml/*.xml type-aliases-package: club.wenfan.youtube.bean
pom.xml 中添加
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build>
两点缺一,都会处出现mapper.xml 文件找不到异常
- 上一篇 »java.lang.NoSuchMethodException: org.apache.ibatis.executor.statement.StatementHandler.prepare,java.sql.Connection
- 下一篇 »SpringBoot报错:nested exception is org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk.test.User matching [java.lang.Long, java.lang.String, java.lang.String]