天天看點

Idea @Autowired注入 Mapper報錯

最近學習Spring-boot + Mybatis,發現強大的idea的居然沒法識别注入的Mapper,@Autowired 後直接報錯。

Idea @Autowired注入 Mapper報錯

雖然不影響項目運作但是紅色error辣眼睛,最後找到在@Mapper注解後面添加@Repository,不用去粗暴關閉idea中Autowired不成功的提示了,畢竟智能提示是idea一大利器。

Idea @Autowired注入 Mapper報錯

最後在原來報錯的地方,消失了,idea在我心中的形象又高大了起來!