1. 解决使用
@SpringBootApplication
@MapperScan("com.edu.mapper") //配置扫描包
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

  1. 扫描相对应的配置文件
mybatis:
  #一定不能错,要不然Mapper扫描不到,在主类配置MapperScan
  #对你的静态资源resources下的资源匹配
  mapper-locations: classpath:mapper/*.xml
  type-aliases-package: com.edu.entity