The Spring integration isn't something I'd looked into deeply. I just assumed
I'd be repeating my list of actions, knowing only what I have read about so far.
This isn't the first time struts2 has proved my assumptions wrong - and always
in a good way I'm glad to report.
Laurie Harper on 14/08/07 17:03, wrote:
Adam Hardy wrote:
[snipped]
It seems like struts2 says:
1: here's struts.xml where you configure your actions
2: here's an autowiring interceptor and it uses Spring to grab
dependencies for your actions
3: by the way, if you want to list all your actions in Spring as well
as in struts.xml, it's kind of cool.
Of course at point 3 I immediately think, why would I want to do that
again? Can't I save myself the effort of doing it twice? I guess I'm
expecting an attribute on the action node that would define an object
factory reference where the action bean would be found, instead of a
class.
Isn't that what you get when you use the Spring plugin? Instead of your
action mappings specifying fully qualified class names, they specify a
logical name which is defined by your Spring configuration. With that
done you have all the advantages of Spring, such as dependency
injection, the ability to substitute alternative implementations of your
actions (or their dependencies) by swapping out configurations, etc.
Again, the Spring plugin is entirely optional. If you don't want or need
any of the facilities Spring provides to help manage instances of your
actions, you don't need to use the Spring plugin. If you *do* want to
take advantage of any of Spring's features at this layer, the plugin
makes that facility available to you.
L.
Laurie Harper on 13/08/07 22:11, wrote:
Um, to allow all the capabilities of Spring (dependency injection,
AOP or whatever) to be applied to action instances?
L.
Adam Hardy wrote:
Thanks for the explanation. What would you say the main rationale is
then for using Spring as a factory for the actions instead of the
struts objectfactory?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]