[Reprint] Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample: error

Because I encountered the same problem, using this method is effective for me. In order to facilitate future search, I have reprinted it. Please view the original text:https://www.cnblogs.com/fifiyong/p/5795365.html

Under the Maven project, I want to receive the parameter Id in the url to query the database data through the controller, and display it on the page in the form of json.

The problem after entering the url in the browser:

八月 22, 2016 1:45:22 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [taotao-manager] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample] with root cause
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TbItemMapper.selectByExample
 at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189)
 at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
 at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
 at com.sun.proxy.$Proxy30.selectByExample(Unknown Source)

Reason: Could not find mapper's mapping file

 

Solution:

 <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
 <build>
  <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

</build>

The content of the above nodes is added in the pom.xml file in the parent project under the Maven project

Sorry, I can only explain according to my own situation, I hope I can help friends who have the same error, and I hope that passing experts can give pointers.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324896725&siteId=291194637