You pretty much understood my code from your
explanation.
One thing to note is that the actions don't configure
themselves... it is the interceptor that injects the refrences into the
actions.
So yeah, its basically the same as using external-ref tags
- although less configuration - which is suitable for some
apps.
Cameron.
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Robert Lerner
Sent: Wednesday, 25 February 2004 8:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Spring integration (revisited)
Sent: Wednesday, 25 February 2004 8:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] Spring integration (revisited)
Hi again,
Cameron, I had a look on your code (unfortunately only once I've already started with the ExtRefRes, so maybe i was biased[?]) but i felt that i was kind of _to_ implicit to have the bean properties of the action to lookup references in the IoC container. (Hope I've understood your code right.) Don't get me wrong now, I'm thankful for your support and it was an interesting read of the code :-), but still I feel reluctant to having the actions configure themselves without my explicit supervision.
Your auto wire approach is quiet similar to the resolver approach i guess, but is there any benefits i might have missed besides the no-need for configuration, of ioc, in xwork.xml?
About the resolver stack thing you're absolutely right, i can see that. There is really no need for that since the IoC container can hold all the components u need.
Tanks for all the advice
Rob X - Saviour of the source
------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webworkRobert, See comments inline.-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Robert Lerner Sent: Wednesday, 25 February 2004 11:45 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Spring integration (revisited) Hoya Compadres! First of all, thanks everybody for the help. I've now managed to get our actions "spring enabled" the XW-122 way. I guess I should have tried it out earlier but i got kind of confused by the patch, thinking this was something that applied to xw-beta1 :-/. Although the ExternalReferenceResolver approach was not the way i first had in mind, guess I was thinking it would be done the pico way with an action factory that instantiates my actions. Imoh the action factory approach has one benefit, over the ExtRefResolver, which I feel is that u get one central point for managing/configuring your IoC. With the ExtRefRes I somewhat feel that u get the IoC both in spring and in xwork. On the other hand it's kind of nice to configure your actions at one central point (xwork.xml), maybe in a large application with many actions it would be messy to have your actions IoC:ed in the spring context and configured in the xwork context? (What do u think?) I guess in the end the ExtRefRes wins but for me it's more of a feeling in the gut then something i can motivate really strong.I have tried it both ways, and I didn't like the fact that there was duplicate configuration, which is why I stick to keeping the business objects in spring, and the actions configuration in xwork.xml. Then either using external-ref or a auto wire interceptor, inject the dependencies.What exactly is this ww-extras project referred to from a little here and there? I would be more then happy to help out in any way i can, but I guess I'm a little to new to webwork to really be able to do any coding :---]. I was thinking that maybe I'll write some kind of tutorial/docs on how to get the ExtRefResolver up'n running with spring, would that be of interest? One last thought. As far as my understanding goes, the ExternalReferenceResolver is one component doing the resolving for a particular "xwork-package". Would it be useful to have some kind of stack for resolvers? Say that one action needs some kind of component from spring and an other action (in the same package) needs some kind of component from jndi. Would it then be useful to have a stack of one spring resolver and one jndi resolver? Or is it safe to assume that the components needed are always "enabled" from either an IoC container xor jndi?I had implemented a patch to support multiple external ref resolvers, but since nobody needed this feature, it was not accepted. Read about it here http://www.mail-archive.com/[EMAIL PROTECTED]/msg06 928.html Since then, I moved to the auto wire interceptor approach, using spring for the container. In the case of using a JNDI resource, get spring to look up the jndi bean http://www.springframework.org/docs/api/org/springframework/jndi/JndiObjectF actoryBean.html Then use the external-ref tag to give it to the action. This pattern will work for pretty much any external refrence that you will need... i.e. there probably isn't any need to support multiple IoC containers within xwork. CameronRegards Rob X - Saviour of the springThere are multiple ways to integrate spring into webwork2/xwork It really depends on what you want. The most simple soloution that I have buit for our apps is: 1) All of our business logic are implemented in beans thatare managed byspring. They all implement the com.datacodex.Service interface 2) I wrote a XWorkInterceptor to auto wire the webwork2actions by type. Itis attached. That is it - quite simple - and automatic. Some problems that may arise with this technique are : 1) multiple beans in spring of the same type a) you could modify the provided interceptor to autowireby type AND byname 2) your business objects don't implement a set interface a) you could attach a marker interface to them quite easily, or b) you could autowire by Name only, or c) you could use spring as an action factory (more complexintegration andconfgiuration) I will, when time permits update the webwork2/xwork wikidescribing thispattern, and these options. I also plan on adding this code into the webwork-optional or webwork-extensions project. One thing that may help with 2c is if webwork/xworksupported configurationfor factories, rather than hardcoding them in. - Pat / Jason.. Any commentshere Cameron-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Patrick Lightbody Sent: Tuesday, 24 February 2004 10:07 AM To: [EMAIL PROTECTED] Subject: RE: [OS-webwork] Spring integration (revisited) We want to get this stuff in to the webwork-extras project asap so that there is a common place for these types of integrations. If anyone wants to try their hand at this, just drop me an email and request developer access to webwork-extras project to get commit access. Patrick-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf OfFrancisco Hernandez Sent: Saturday, February 21, 2004 10:09 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Spring integration (revisited) I was able to get this working by following the directionson the jiraissue: http://jira.opensymphony.com/secure/ViewIssue.jspa?key=XW-122 check out the SpringSupport.zip and look at the tests,they are alsoofhelp to see how all if this works together. Robert Lerner wrote:Hola compadres! [I'm kind of new to both webwork and spring but stronglyfeel thatthey are great projects... so please go easy on me if I ask some incredibly stupid questions :-)] I'm working on a project where we are using webwork, andspring forboth IoC and AOP (specifically for the transactions).What I wouldlike to do is to have my actions "aware" of the dao that isconfiguredin spring. I've tried to read the previous discussions in themailinglists on this subject but have not really been able to figure outhowto do this. Is it even possible with ww2.0 and xw1.0? If not does someone have any idea of how to get this working? The KW-122 issue in the jira seem to provide a workingsolution, buthow do I integrate this in my application? The xwork-ext stuff, which i assume that this KW-122stuff has gonein to where can i find that? Any help greatly appreciated! /Robert Lerner