ssm項目tomcat啓動報錯

今天在做完項目一個模塊進行打包測試,啓動tomca的時候出現如下錯誤:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'suHandlerServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'alarmInfoMapper' is expected to be of type 'com.sunrtnet.gzcxs.dao.SuAlarmInfoMapper' but was actually of type 'com.sun.proxy.$Proxy43'

檢查了好久發現,在不同的包裏用@Autowired注入Mapper的時候,用了相同的Mapper名字alarmInfomapper,將其中一個改掉,項目就能正常啓動了。

一般出現類似情況可以從如下幾個方面解決:

1、檢查相應的dao層有沒有加@repository註解。

2、根據提示去項目全局搜索相關bean(例如我就是全局搜索'alarmInfoMapper',才發現有兩處注入了使用該名字的Mapper

開發小結


   

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章