spring容器注入错误总结Cannot resolve reference to bean '***' while setting bean property 'ref'
启动tomcat时如下报错严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.oracle.test.TestService': Cannot resolve reference to bean 'testService' while setting bean property 'ref'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testService' is defined
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testService' is defined
错误出现的原因有如下几点:1.spring配置文件中接口或扫描的包名写错,在注入IOC容器的时候出现错误。
2.dubbo的服务提供者的配置文件中接口错误,导致找不到接口。
3.controller层没有写autowired,或service的实现没有写service注解
更多推荐
所有评论(0)