1,@Mapper annotation :
effect : Added to the interface class @Mapper, After compiling, the corresponding interface implementation class will be generated
Add location : Interface class
@Mapper public interface UserDAO { // code }
If you want every interface to become an implementation class , You need to add @Mapper annotation , It's troublesome , To solve this problem @MapperScan

2,@MapperScan
effect : Specifies the package in which the interface to become an implementation class is located , Then all interfaces under the package will generate corresponding implementation classes after compilation
Add location : It's in Springboot Add ,
@SpringBootApplication @MapperScan("com.winter.dao") public class
SpringbootMybatisDemoApplication { public static void main(String[] args) {
SpringApplication.run(SpringbootMybatisDemoApplication.class, args); } }
add to @MapperScan(“com.winter.dao”) After annotation ,com.winter.dao Interface class under package , After compiling, the corresponding implementation class will be generated

3, use @MapperScan Annotate multiple packages
( In actual use, it is modified according to its own package path )
@SpringBootApplication @MapperScan({"com.kfit.demo","com.kfit.user"}) public
class App { public static void main(String[] args) {
SpringApplication.run(App.class, args); } }
4, If dao Interface class does not exist in Spring Boot The main program can scan under the package or sub package , You can configure it in the following ways :
( It's not verified , Not sure if it can be used , You may need to modify the path based on your own defined package name )
@SpringBootApplication @MapperScan({"com.kfit.*.mapper","org.kfit.*.mapper"})
public class App { public static void main(String[] args) {
SpringApplication.run(App.class, args); } }