Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to config mybatis mapper xml files in Spring boot's application.yml

I am a newbie to spring boot and I want to make my spring boot application integrate with mybatis and mysql database. I generate the entity,mapper interfaces,and the mapper xml files with the generator. And I also use @MapperScan annotation to tell the application how to find the mappers, my application.yml looks like following:

spring:
  datasource:
    username: root
    password:
    url: jdbc:mysql://localhost:3306/bidding
    driver-class-name: com.mysql.jdbc.Driver

mybatis:
  mapperLocations: classpath:mapping/*.xml

But when I run the application with command 'mvn spring-boot:run', it always give me the error message 'Invalid bound statement (not found)'.

Is there anything I missed in my code?

like image 663
merthmagic Avatar asked Dec 22 '25 03:12

merthmagic


1 Answers

Something wrong with the mapping of mybatis interface and xml.

  1. check package of interface and xml ,they should be the same package
  2. check the namespace in xml and package of xml,they should be same path
like image 151
wcong Avatar answered Dec 24 '25 11:12

wcong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!