十一月 27, 2018 5:13:03 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [taotao-manager-web] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TestMapper.queryNow
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.taotao.mapper.TestMapper.queryNow
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.$Proxy31.queryNow(Unknown Source)
at com.taotao.service.impl.TestServiceImpl.queryNow(TestServiceImpl.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
mapper映射文件不发布问题
原因在maven工程,mapper的xml文件放在src/main/java文件夹
解决方案:
1.将文件放在src/main/resources文件夹
2.在pom.xml添加如下依赖
<build>
<!-- 如果不配置mybatis的配置文件会漏掉 -->
<!-- 注意:配置了此方式,原来的默认的资源拷贝行为将无效 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>