SSH-service错误

来源:互联网 发布:js函数返回true false 编辑:程序博客网 时间:2024/06/05 09:22

type Exception report

message Unable to instantiate Action, book.action.BookAction, defined for 'user' in namespace '/'Error creating bean with name 'book.action.BookAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookService' must be of type [book.service.impl.BookServiceImpl], but was actually of type [com.sun.proxy.$Proxy85]

description The server encountered an internal error that prevented it from fulfilling this request.

exception

Unable to instantiate Action, book.action.BookAction,  defined for 'user' in namespace '/'Error creating bean with name 'book.action.BookAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookService' must be of type [book.service.impl.BookServiceImpl], but was actually of type [com.sun.proxy.$Proxy85]com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316)com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)



原因是 private BookServiceImpl bookService;

不能直接用实现类,要用接口

改为: private BookService bookService;

0 0