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"
<bean id="taskService" factory-bean=" jbpmConfiguration "
<bean id="repositoryService" factory-bean="jbpmConfiguration"
<bean id="executionService" factory-bean="jbpmConfiguration"
<bean id="historyService" factory-bean="jbpmConfiguration"
<bean id="managementService" factory-bean="jbpmConfiguration"
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" />