springboot 报错 IDEA: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

The springboot project encountered IDEA: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)an exception when using Mapper .
Many times, I always forget, record it

The reason is that we cannot find the mapper.xml we wrote, and we need to add configuration information in the following two places:

application.properties

#mbatis 映射
mybatis.type-aliases-package=com.fengmi.mac_keeper
mybatis.mapper-locations=classpath*:com/fengmi/mac_keeper/**/*.xml

pom.xml

Add resource filtering xml when compiling, so that the *Mapper.xml we defined can be compiled in during compilation.

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                    <include>**/*.yml</include>
                    <include>**/*.html</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                    <include>**/*.yml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Guess you like

Origin blog.csdn.net/lijie2664989/article/details/106252383