Is anyone working on integration between Xwork and the Spring Framework.

I have managed to create a webwork interceptor that allows a xwork action to make use of any spring bean by creating a simple mapping.

However, I would like a better soloution that uses spring as the action facory.. And I would like to do this without duplication of configuration in both xwork.xml and applicationContext.xml

One main reason that I want to use spring is to take advantage of its AOP framework, and most specifically the Hibernate Transaction Interceptor.

Therefore I would like to declare the transactional attributes for the action methods within spring, with a refrence to the xwork action.

I woule like to still use WebWork's interceptors as normal - timing, logging, params, chain, etc.. because they have different semantics to spring.

One way that I think this is possible is to create :

Spring Objects :
a spring action factory bean, configured with the action namespace and name and the transactional attributes
this factory would lookup the action config for the classname and construct the action, wrap it in a proxy, attaching the interceptors.


WebWork Objects
SpringServletDispatcher - to call ActionProxyFactory.setFactory(new SpringActionProxyFactory())
SpringActionProxyFactory - to override createActionInvocation to use a SpringActionInvocation
SpringActionInvocation - to override createAction - to delegate to WebApplicationContextUtils.getWebApplicationContext(servletContext).getBean(beanName) to use the factory within spring to contruct this action.


This way the xwork.xml file remains untouched and all that is needed is a bean entry in applicationContext.xml that defines each action's transactional attributes.

Something like :

<bean id="defaultActionTransactionAttributes" class="com.datacodex.spring.beans.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="execute">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>


<bean id="admin.SpringAction" class="WebworkActionFactoryBean">
<property name="action"><value>/admin/SpringAction</value></property>
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="transactionAttributes"><ref local="defaultActionTransactionAttributes"/></property>
</bean>


I am open to suggestions for other ways to do this.

Anyone have any thoughts / ideas ?

Cameron

--
Any damn fool can write code that a computer can understand...
The trick is to write code that humans can understand.
[Martin Fowler http://www.martinfowler.com/distributedComputing/refactoring.pdf]





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to