Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 23833 invoked from network); 8 May 2008 14:16:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2008 14:16:13 -0000 Received: (qmail 19065 invoked by uid 500); 8 May 2008 14:16:06 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 19032 invoked by uid 500); 8 May 2008 14:16:06 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 19021 invoked by uid 99); 8 May 2008 14:16:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 May 2008 07:16:05 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Brian.Relph@cerner.com designates 159.140.213.229 as permitted sender) Received: from [159.140.213.229] (HELO mail02.cerner.com) (159.140.213.229) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 May 2008 14:15:13 +0000 Received: from msbhwhq02.northamerica.cerner.net (msbhwhq02.cerner.com [10.160.16.184]) by mail02.cerner.com (8.13.8/8.13.8) with ESMTP id m48EFVhH023202 for ; Thu, 8 May 2008 09:15:34 -0500 Received: from EMAIL02.cerner.net ([10.160.17.18]) by msbhwhq02.northamerica.cerner.net with Microsoft SMTPSVC(6.0.3790.3959); Thu, 8 May 2008 09:15:28 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Injecting Spring Services into Struts 2 Actions Date: Thu, 8 May 2008 09:15:26 -0500 Message-ID: <019EB22ED464A146A26211222DD06E17CE0A9C@EMAIL02.cerner.net> In-Reply-To: <6360445556B02A4BB76993AD583BF97DEE04D9@EXCHANGE2.biperf.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Injecting Spring Services into Struts 2 Actions Thread-Index: AcixD4LNiWLBE79yQ5qLr+z+UrhKWQABYpwQ References: <6360445556B02A4BB76993AD583BF97DEE04D9@EXCHANGE2.biperf.com> From: "Relph,Brian" To: "Struts Users Mailing List" X-OriginalArrivalTime: 08 May 2008 14:15:28.0167 (UTC) FILETIME=[F74F7B70:01C8B115] X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.7161:2.4.4,1.2.40,4.0.164 definitions=2008-05-08_07:2008-05-08,2008-05-08,2008-05-08 signatures=0 X-Virus-Checked: Checked by ClamAV on apache.org The actions are auto-wired by name by default - so if any of its properties= match bean-ids in your spring config, and they have setters, then those pr= operties will get set. The part about declaring the dependencies means you disable the auto-wiring= , and declare your actions as spring beans. So, instead of this: /WEB-INF/view/index.jsp You would do this: /WEB-INF/view/index.jsp Along with additional spring config: Notice this does not actually disable auto-wiring (you would have to set th= e auto-wire attribute in the spring config, either globally or per-bean), b= ut it does declaratively state what to set on the action as properties. Brian Relph -----Original Message----- From: Asleson, Ryan [mailto:asleson@BIWORLDWIDE.com]=20 Sent: Thursday, May 08, 2008 8:29 AM To: Struts Users Mailing List Subject: Injecting Spring Services into Struts 2 Actions =20 Hello, =20 I found this guide to injecting Spring beans into Struts 2 Actions: =20 http://cwiki.apache.org/WW/spring.html =20 According to the red box at the bottom of the document, the Struts 2 Action= does not need to be registered with Spring. So far so good. =20 However, I'm a little unclear as to how exactly it "knows" what Spring bean= s to inject into the Struts 2 Action. Assuming I have a Struts 2 Action th= at depends on a PersonService, I assume that the Struts 2 Action would have= a public mutator for the PersonService like this: =20 public void setPersonService(PersonService service) { this.personService =3D service; } =20 How does the injection system "know" that this method should be used for in= jecting a Spring bean? Imagine that the Struts 2 Action has several "set" = methods, and that there are a number of configured Spring beans. It would take way too long for the injection system to look through every "= set" method on the Action and try to find a matching Spring bean, especiall= y if there are a lot of Spring beans (and there usually are). =20 The document above includes this comment: =20 We strongly recommend that you find declarative ways of letting Spring know= what to provide for your actions. =20 But it doesn't give an example of how to let Spring know what to provide to= the actions. =20 So, the question is: How do I tell Spring what beans need to be injected i= nto the Action? =20 Thanks!!!! =20 -Ryan =20 =20 This e-mail message is being sent solely for use by the intended recipient(= s) and may contain confidential information. Any unauthorized review, use,= disclosure or distribution is prohibited. If you are not the intended rec= ipient, please contact the sender by phone or reply by e-mail, delete the o= riginal message and destroy all copies. Thank you. ---------------------------------------------------------------------- CONFIDENTIALITY NOTICE This message and any included attachments are from C= erner Corporation and are intended only for the addressee. The information = contained in this message is confidential and may constitute inside or non-= public information under international, federal, or state securities laws. = Unauthorized forwarding, printing, copying, distribution, or use of such in= formation is strictly prohibited and may be unlawful. If you are not the ad= dressee, please promptly delete this message and notify the sender of the d= elivery error by e-mail or you may call Cerner's corporate offices in Kansa= s City, Missouri, U.S.A at (+1) (816)221-1024. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org