問題點
- 這個報錯可能導致程序運行大面積爆紅
- 這個報錯會逼瘋強迫症
解決方法
為避免程序運行報錯 ,需要在Application.class添加注解@MapperScan(mapper包位置)
@SpringBootApplication // 掃描包mapper注解 @MapperScan("com.linghangcloud.fegert.mapper") public class FegertApplication { public static void main(String[] args) { SpringApplication.run(FegertApplication.class, args); } }
修改避免了運行時異常,但是問題依舊。
每個mapper類前加上@Repository注解
@Repository @Mapper//@Mapper注解 springbboot能否自動掃描識別 public interface UserMapper extends BaseMapper<User>{ }
文章轉載至:https://blog.csdn.net/weixin_44779019/article/details/101112387