1. Problem description
Create a new springboot project to integrate mybatis, mapper.xml The file is placed under resource mybatis.mapper Under the table of contents:
Start the item item, execute the query in XML, SQL report error:
SQL is not bound.
2. Debugging tracking
Debug discovery when you can start a project mapper.xml Unable to load.
A variety of comparison and tracking source code found when
Mapper locations is set to classpath:mybatis.mapper/ * Mapper.xml
The program is normal.
3. Results
The result shows that there is a problem in creating the directory file under resource.
Instead of creating a secondary directory folder, a folder named“ mybatis.mapper “At the first level. By rebuilding a mybatis folder and a mapper subfolder, the problem is solved.