日期:2014-05-20 浏览次数:20903 次
<!-- Service --> <bean id="login" class="com.qiaogu.service.anonymous.LoginService" scope="prototype" autowire="byName"/> <!-- Action --> <bean id="loginAction" scope="prototype" class="com.qiaogu.action.anonymous.LoginAction"> <property name="service" ref="login" /> </bean>
public LoginService getService(){ return (LoginService)service; }
Unable to instantiate Action, loginAction, defined for 'login' in namespace '/'Error creating bean with name 'loginAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.qiaogu.service.anonymous.LoginService] to required type [com.qiaogu.service.anonymous.LoginService] for property 'service'; nested exception is java.lang.IllegalArgumentException: Original must not be null com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:306) com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387) com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186) org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) 更多底层异常省略 ...
<!-- Service --> <bean id="loginService" class="com.qiaogu.service.anonymous.LoginService" scope="prototype" autowire="byName"/> <!-- Action --> <bean id="loginAction" scope="prototype" class="com.qiaogu.action.anonymous.LoginAction"> <property name="loginService" ref="loginService" /> </bean>