springboot查询mybatis报错: org.apache.ibatis.binding.BindingException: Invalid bound statement

解决方法: 检查xml配置是否被扫描到。

1. 在pom.xml文件中添加,否则xml文件不能被扫描到:

<build>    
         <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
</build>

2. 添加mybatis的xml映射文件扫描, mybatis-plus和mybatis的添加方法: 

mybatis-plus.mapper-locations = classpath:com/hand/hcf/cloud/**/*.xml
mybatis.mapper-locations = com/hand/hcf/app/payment/persistence/*Mapper.xml

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章