org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
In mybatis, there is a problem when the Dao interface and mapper configuration file are mapped and bound. To put it simply, the interface and XML are either not found, or they are found but not matched.
Mapper interface development needs to follow the following specifications:
- Mapper.xml The namespace in the file is the same as the classpath of the mapper interface.
- Mapper interface method name and Mapper.xml The ID of each statement defined in is the same
- Input parameter types and methods of mapper interface mapper.xml The parametertype of each SQL defined in is of the same type
- Mapper interface method output parameter type and mapper.xml The resulttype of each SQL defined in is the same
Then I reported this error myself. After two days of searching for different names, I finally found that the reason for the problem is that the paths of XML and mapper interfaces under resources are different. The package name I created here is com.health.mapper Instead of creating a folder level by level, it creates a com.health.mapper Name of a bag, see the picture:
The right thing to do is this:
So we need tocom/health/mapperCreate it like this