SpringBoot使用注解注入mapper报错Find why ‘xxxMapper’ could be null解决方案

创建测试类插入数据

但是报错

image-20220910185141954

image-20220910184951593

原来junit用的是4版本的

image-20220910185204517

junit-jupiter5的@Test注解

image-20220910185303494

再次运行就成功了

成功运行

image-20220910185022523

Q.E.D.


春风亦有春风愁,不劳春风为我忧