スプリングは注入できません

49210 ワード

struts 2統合spring 3起動エラーなくSpring初期化に成功しました.情報:Initializing Spring root WebAppliation Contect
しかし、actionではspringでは注入できないdaoやserviceは使えません.
解決策:
1、struts 2-spring-plugin.jarパッケージに入っていません.
2、設定ファイルが本当に大丈夫かどうかを確認する
3、struts.xmlでaction配置のclassパスをaplication.xml配置の対応actionのid属性に修正します.
変更前:
[html] view plin copy
  1. <struts>
  2. <packagename="budget"extends="struts-default">
  3. <actionname="login"class="com.bean.LoginAction"method="verifyUser">
  4. <resultname="success">finance_center/center.jsp</result>
  5. <resultname="error">login/error.jsp</result>
  6. </action>
  7. </struts>
変更後:
[html
view plin
copy
<struts><packagename=「budget」extens=「struts-default」<actioname=“login”class=“loginnAction”method=“verifyUser”<reultname=「success」financeセンター/センター.jsp<resultname=「error」login/error.jsp<struts>springプロファイルは不変です.
[html] view plin copy
  1. <beanid="loginAction"class="com.action.LoginAction"scope="prototype">
  2. <propertyname="service">
  3. <refbean="loginService"/>
  4. </property>
  5. </bean>
第三の原因はお父さんによくないです.二時間も苦労しました......