|
From: <jue...@we...> - 2003-10-09 16:17:19
|
Matthew, everybody,
My XWork/Spring integration proposal is no secret -- here it is, cut =
from a recent mail to Jason and Mike. We've been discussing IoC options =
for XWork/Conductor for quite a while, mainly in terms of PicoContainer =
vs Spring.
<quote>
As far as I see, the XWork config file supports setting bean properties =
as parameters on actions like this:
<action name=3D"Bar" class=3D"com.opensymphony.xwork.SimpleAction">
<param name=3D"foo">17</param>
<param name=3D"bar">23</param>
</action>
This is obviously pretty similar to a Spring bean definition, just =
specific for a WebWork action. A significant difference is that the =
Spring property tag can tag either a value tag or a ref tag within, i.e. =
either specify a parameter value or a=B4dependency on another bean.
Currently, I see the easiest way of accessing a Spring context from =
XWork via a tag that resolves an external component reference, a la:
<action name=3D"Bar" class=3D"com.opensymphony.xwork.SimpleAction">
<param name=3D"foo">17</param>
<external-ref name=3D"bar">myDataSource</external-ref>
</action>
XWork could fetch the Spring context then, look up the bean named =
"myDataSource", and set the reference into the "bar" bean property of =
the "Bar" action. This would be intuitive, as it works analogously to =
setting a parameter value, and flexible, as it allows to reference any =
specific instance. Effectively, you would be accessing beans in a Spring =
middle tier context rather than letting Spring touch your action =
instances - but that's not a disadvantage, rather a clean separation of =
responsibilities.
Of course, the Spring support for such external references can be =
pluggable in XWork, potentially replacing the current ComponentManager =
mechanism with its enabler interfaces. Any such resolver for external =
references would simply need to return an object for the given symbolic =
name. The interface could look like this:
public interface ExternalReferenceResolver {
Object resolveReference(String name);
}
A Spring implementation would grab a reference to the Spring application =
context and call getBean with the given name. The application context =
itself could get initialized on XWork startup, initializing its =
singletons upfront. I consider such an XWork/Spring integration as =
pretty simple but very powerful: no enabler interfaces, just bean =
properties with component types, and an external-ref tag in addition to =
the param tag.
</quote>
Juergen
-----Original Message-----
From: Matthew E. Porter [mailto:ma...@me...]
Sent: Thursday, October 09, 2003 4:16 PM
To: j=FCrgen h=F6ller [werk3AT]
Subject: Re: [Springframework-user] Introduction and Hibernate-Spring
queries
>
> Throwing in Spring as middle tier glue is a good idea, of course :-)=20
> Have you already thought about my proposal regarding XWork/Spring=20
> integration from some days ago? Finally, we're of course open for any=20
> suggestions and enhancement requests on the Spring side of things!
>
I this proposal in the public space. I would also like to see=20
XW/WW2-Spring integration in the near term future.
Cheers,
matthew
|