Dear all,
I have a BPM application based on JBoss + JBPM 3.2. I'd like to know if it's possible to inject an Action Class to another Class using Spring.
Here's the case:
<state name="TIMEOUT">
<event type="node-enter">
<action class="jbpm.action.ProcedureExecutor"/> </event>
<transition name="" to="P_CONF_MAN"></transition>
</state>
When ProcedureExecutor is fired, then I'd like to use Spring to decide which DAO class needs to be invoked
public class ProcedureExecutor implements ActionHandler
......
private String procedureName;
public void execute(ExecutionContext arg0) throws Exception {
this.procedureName = "MyProcedure";
Resource res = new ClassPathResource("applicationContext.xml");
BeanFactory factory = new XmlBeanFactory(res);
// Here invoked DAO(ProcedureExecutor)
BaseDAO bean1 = (BaseDAO)factory.getBean("BaseDAO");
bean1.execute();
}
I have configured my spring file so that an instance of ProcedureExecutor is passed to DAO
<bean id="ProcedureExecutor"
class="jbpm.action.ProcedureExecutor">
</bean>
<bean id="BaseDAO"
class="jbpm.dao.BaseDAO">
<constructor-arg><ref bean="ProcedureExecutor"/></constructor-arg>
</bean>
The problem is that when an instance of ProcedureExecutor is passed to DAO, it's not passed the same instance of ProcedureExecutor I have in memory, so the property "procedureName" is null.
I guess the problem is that ProcedureExecutor was instantiated by the container and not by myself ?
Does anybody know if it's possible to use Spring to inject a JBPM Action class ?
Hope I was clear....
Thanks a lot
Francesco