错误如下:
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"