Springboot reports an error org.apache.ibatis.binding.BindingException after integrating mybatis

the problem is as follows: after springboot integrates mybatis, two methods are written, one is normal and the other is error.

mapper.xml:

mybatis:

pom.xml:

error message and directory are described above. Ask the great god for an answer

Mar.18,2021

looks like the mapper.xml file was not scanned


after self-examination, it is found that although both application.properties and application.yml files can be used as configuration files in springboot projects, the formats are different and must be written strictly according to the format.
and my mistake is in the properties file with the following format:

mybatis-plus:
  mapper-locations: classpath*:cn/keyidea/basic/**/mapping/*.xml
  typeAliasesPackage: cn.keyidea.basic.modular.system.model
  

and this format should have been written in the yml file. Just change it to the following:

mybatis.mapper-locations: classpath:com/example/dao/mapper/*.xml
mybatis.typeAliasesPackage: com.example.entity


image.png
I made a mistake earlier because the mybatis package was misreferenced.

Menu