springboot+mybatisplus使用xml找不到mapper的解決辦法


做項目,sql語句比較復雜,所以使用了xml自定義SQL進行查詢,奈何一直報錯


org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xx.springboot.mapper.UserMapper.Select


在application.xml 配置

mybatis.mapper-locations=classpath*:/com/xx/springboot/mapper/*.xml


pom.xml 配置

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <!--引入mapper對應的xml文件-->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM