Java Reference
In-Depth Information
Finally, we begin configuring jBPM. This part is, in its most minimal incarnation, a very forgiving
three lines of XML. The services we configure afterwards— processEngine , repositoryService ,
executionService , historyService , managmentService , and taskService —are configured for the express
purpose of being able to inject them. You could as easily inject the jbpmConfiguration bean and
manually access those services from the jbpmConfiguration . Succinctly, they're very much optional,
and you're as good as done with just the jbpmConfiguration instance.
<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration"
<constructor-arg value="jbpm.cfg.xml" />
<bean id="processEngine" factory-bean="jbpmConfiguration"
factory-method="buildProcessEngine" />
<bean id="taskService" factory-bean=" jbpmConfiguration "
factory-method="getTaskService" />
<bean id="repositoryService" factory-bean="jbpmConfiguration"
factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="jbpmConfiguration"
factory-method="getExecutionService" />
<bean id="historyService" factory-bean="jbpmConfiguration"
factory-method="getHistoryService" />
<bean id="managementService" factory-bean="jbpmConfiguration"
factory-method="getManagementService" />
When you try to use these beans in your service or some client, be aware that several of these
beans have the JbpmConfiguration super class ( JbpmConfiguration is in turn the super class of
SpringConfiguration .) Thus, you can't use @Autowired by itself on a single instance variable because, to
Spring, the choice of which bean to inject is ambiguous. If you do use the @Autowired annotation, use an
array or collection type so that the multiple matched instances can be injected because there's
To precisely specify the bean you're looking for, you can use Spring 3's @Value annotation and a
Spring Expression Language expression, or JSR 250's @Resource annotation and a bean's name, or you
could simply handle the configuration in Spring's XML format, referencing the bean by name.
At this point, all that remains is to specify the jBPM configuration itself ( jbpm.cfg.xml ), which is
fairly boilerplate and you can use, unchanged, for a vast many solutions.
<?xml version="1.0" encoding="UTF-8"?>
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
Search WWH ::

Custom Search