SpringBoot 报错 Invalid bound statement (not found)

Scenario: Using IDEA to develop a springBoot project, an error is reported during debugging: As shown in the figure:

This error is an invalid binding state. Simply put, the Mapper class and Mapper.xml cannot find each other.

 Troubleshooting methods:

1. The name of the Mapper interface and the name of the Mapper.xlm file must be exactly the same as shown in the figure:

2. Is the namespace in Mapper.xlm the package name plus the interface name in the Mapper interface?

3. Is the id in Mapper.xlm the method name in the Mapper interface? Copying the past usually won't go wrong.

4. Please note that there should be no spaces in Mapper.xlm as shown in the figure:

 My fault is not in the above, but in the config file:

The original configuration is like this classpath*:mappers/mysql/*.xml

After compiling the project, check the Target and find something like this:

Obviously it's wrong. Just change the configuration file to classpath*:mappers.mysql/*.xml and it will be ok.

Summary: Pay attention to the table of contents and details when writing

Guess you like

Origin blog.csdn.net/beautifulYuan/article/details/118678948