IDEA在編輯時提示could not autowire

本文轉自:點擊打開鏈接



在開發中我再applicationContext-dao.xml中加入了mapper掃描器

[html] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. <!--mapper掃描器-->  
  2. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">  
  3.     <!--掃描包路徑,如果需要掃描多個包,中間使用半角逗號隔開-->  
  4.     <property name="basePackage" value="com.qianlv.ssmdemo.mapper" />  
  5.     <!--這裏不用sqlSessionFactory是因爲如果用會導致上面配置的dataSource失效-->  
  6.     <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />  
  7. </bean>  

但是在編輯一個Service中注入mapper會提示could not autowire,但是可以正常執行的。

[java] view plain copy
 在CODE上查看代碼片派生到我的代碼片
  1. public class ItemsServiceImpl implements com.qianlv.ssmdemo.service.ItemsService{  
  2.   
  3.     @Autowired  
  4.     ItemsMapperCustom itemsMapperCustom;  
  5.   
  6.     public List<ItemsCustom> findItemsList(ItemsQueryVo itemsQueryVo) throws Exception {  
  7.         return itemsMapperCustom.findItemsList(itemsQueryVo);  
  8.     }  
  9.   
  10. }  
我們需要改一下IDEA的設置

將最右邊的Serverity改爲Warning


發佈了30 篇原創文章 · 獲贊 27 · 訪問量 67萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章