invalid bound statement(not found)问题

1.检查xml文件所在package名称是否和Mapper interface所在的包名

<mapper namespace=“com.sr.mapper”>
mapper的namespace写的不对!!!注意系修改。

2.mapper的方法在mapper.xml中没有,然后执行mapper的方法会报此

3.因项目运行的是编译的class文件,检查各种资源文件是否编译到运行的文件夹中,如没有pom文件添加

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

猜你喜欢

转载自blog.csdn.net/qq_37515683/article/details/104836999