天天看點

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'MonitorServiceImpl'

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'MonitorServiceImpl'

SSH架構的web開發中,報了這麼一個錯誤。

根據提示:No bean named 'MonitorServiceImpl' is defined   

    就是說你的這個bean沒有定義,spring找不到

解決思路:

1.是否正确使用注解将bean放入Spring容器中,如@Service

2.判斷bean所在的路徑是否在Spring的掃描範圍内

3.bean的預設第一個字母小寫(這也是我犯錯誤的原因,我直接複制類名,忘記把第一個字母小寫了,粗心啊!!!)

    比如我這裡,把MonitorServiceImpl改為monitorServiceImpl就好了

繼續閱讀