Hi,
We're taking the approach of running multiple ProcessEngines in a single app server (each with a DataSource pointing to a different database schema) to provide multi-tenant support in an application. We need to spin up engines on demand as customers come in, so we can't pre-configure them beforehand in the Spring configuration files.
I'm now able to build the ProcessEngines programatically instead of through Spring configuration, but i'm now finding that the Spring beans that I was previously accessing in BPMN expressions are no longer available.
Example configuration:
<userTask activiti:candidateUsers="${groupBean.getCandidateUsers(execution,'blah')}" …
Example output when test is run:
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'groupBean'
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:79)
at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
…
The error makes sense: Spring can't inject the beans used in the expression as it isn't creating the ProcessEngine instance.
Question: Is there another 'blessed' programatic way to make a ProcessEngine aware of such beans if the Spring approach is no longer available?
I looked through the Activiti source and found the following method on org.activiti.spring.ProcessEngineFactoryBean:
public ProcessEngine getObject() throws Exception
The implementation of this makes the following call
processEngineConfiguration.setExpressionManager(
new SpringExpressionManager(applicationContext, processEngineConfiguration.getBeans()));
which looks like it might do the trick, but when I add this to my code that builds the ProcessEngine, it still can't see the beans.
FYI - I'm using Activiti 5.4.
Thanks,
bwd