[How to Solve] Invalid bound statement (not found)

When integrating mybatis with springboot, an error of invalid bound statement (not found) is reported. After repeated changes and trial and error, it is found that mapper.xml cannot be scanned. The key lies in two aspects.

    1. if you put XML in the Java directory, you need to configure the path in the POM package
<resources>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/sqlmap/*.xml</include>
				</includes>
				<filtering>false</filtering>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>**/*.*</include>
				</includes>
				<filtering>true</filtering>
			</resource>
		</resources>
      1. add the statement of scan mapping file to mybatis configuration class
 PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        sessionFactory.setMapperLocations(resolver.getResources("classpath*:**/sqlmap/*.xml"));//扫描映射文件
        1. if the mapper.xml file is placed in the resources directory, maperlocations should be configured in application.yml
mybatis:
  mapper-locations: classpath:mapping/*.xml  #Note: Be sure to correspond to the path where the mapper mapping xml file is located

Read More: