org.springframework.beans.factory.BeanCreationException: Error creating bean with name '***'
2015-03-23 19:22
806 查看
错误如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'newsService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.zhym.service.NewsService]: Specified class is an interface
Caused by:
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.zhym.service.NewsService]: Specified class is an interface
错误原因:首先确保service接口的实现类没有错,然后查看applicationContext.xml中对此service的声明,是否把bean中class后的包名中的service实现了写成了service接口。比如service接口名:UserService.java,其实现类为UserServiceImpl.java,而你的bean写成了<bean name="userService" class="com.zyy.service.UserService><!--省略中。。。--></bean>,这里只需把class改为:class="com.zyy.service.UserServiceImpl"
错误如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'newsService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:
Could not instantiate bean class [com.zhym.service.NewsService]: Specified class is an interface
Caused by:
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.zhym.service.NewsService]: Specified class is an interface
错误原因:首先确保service接口的实现类没有错,然后查看applicationContext.xml中对此service的声明,是否把bean中class后的包名中的service实现了写成了service接口。比如service接口名:UserService.java,其实现类为UserServiceImpl.java,而你的bean写成了<bean name="userService" class="com.zyy.service.UserService><!--省略中。。。--></bean>,这里只需把class改为:class="com.zyy.service.UserServiceImpl"
相关文章推荐
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'selectcommoninfo' defined in ServletCont
- ssh2 整合 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in Servl
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContex
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'powerAction'
- 解决org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.spring
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContex
- 关于org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFac
- nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Can
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'infoContentA
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lanagerServi
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springfr
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseDAOFacto
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
- Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'o
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name'se
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name '[beanName]'