SpringBoot&Mybatis appears Binding Invalid bound statement in @ Test

the program can run normally, but as long as it uses Spring test, it will make an error
Binding Invalid bound statement (not found) can only find XML

Debug finds a point when sessionFactory.setMapperLocation
classpath is mapped to target/test-classes so that resources cannot be found and normal startup is target/classes

clipboard.png

but most of the online practices for mapper-location are
classpath: * * / xml
and there is no problem using @ Test testing

Why is this the case with @ test classpath here?

so how to find this mapper.xml in both test and normal operation now

I checked a lot and couldn"t find what I missed

Don"t say transfer mapper to the package, this is how my previous project was configured.
I just want to know why I failed to configure online. I don"t know much about Spring boot test
Thank you


is the tool IDIA? if so, the output path should not be properly configured


the output path is not configured is farting.
I think the output path is configured.
compiled classes has a corresponding resource file
, but test's classpath corresponds not to classes but to test-classes, which is uncomfortable

.

now is the time to add environment variables to test so that each module looks from the original classes instead of test-classes when reading files from classpath in test.

Menu