Springboot configuration mybatis cannot find mapper.

1. Build the demo of springboot manually. The project service layer auto injection does not show that it cannot be injected. But the method that calls the service layer will statement not found. Then the @ Qualifier () annotation is used, and the service layer is called successfully. As a result, the method call in the dao layer reports the same error. You can query normally with jdbc. Please ask all the immortals to see what"s going on
start the class


mybatis


.

I just saw a warning in the startup log
2018-03-20 10 main 22 br 41.074 WARN 4608-[main] o.m.s.mapper.ClassPathMapperScanner: No MyBatis mapper was found in"[spring-boot.spring-boot.boot-dao] "package. Does Please check your configuration.
have no mapper mapping interface class for mybatis? Are there any special requirements for springboot"s Dao layer

Mar.06,2021

MapperScan is the scanned mapper interface package, not the xml


in the resource directory, so your MapperScan comments should go like this:
@ MapperScan ("spring_boot.spring_boot.boot_dao")
or Mapper interface class with @ Mapper
add-
is mybatis-config.xml missing in your project?


your scan path is written incorrectly, starting below java. Your entry class is under spring_boot.spring_boot, and it won't scan up.


there is nothing wrong with the first two screenshots, and the package that starts the class scan is the package where the mybatis java interface is located. The problem lies in the third picture. When scanning xml files, you should not add resources, classpath:mapper/*.xml.

Menu