1. 程式人生 > >使用Junit單元測試,Invalid bound statement (not found)

使用Junit單元測試,Invalid bound statement (not found)

使用springMvcTest的時候發現Invalid bound statement (not found)這個錯誤

 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

原因的話,是沒有拷貝對應的resources檔案,以及mapping檔案。

需要在pom中配置一下

 <build>
        <finalName>SmartCompus</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

配置完成之後測試,問題解決。

本文出處:https://ask.csdn.net/questions/694403