JBPM和Spring 集成报错

JBPM和Spring 集成时需要在applicationContext.xml如下配置:
<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
        <constructor-arg value="jbpm.cfg.xml" />
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
 <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
 <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
 <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>
 <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
 <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>
但由于jbpmConfiguration和processEngine都实现了同一个接口org.jbpm.api.ProcessEngine, spring容器不知道应该使用哪一个bean ,因此会报出如下错误:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.jbpm.api.ProcessEngine] is defined: expected single matching bean but found 2: [jbpmConfiguration, processEngine]

 

解决方式:
使用注解@Qualifier指定具体的bean
@Autowired
@Qualifier("processEngine")
private ProcessEngine processEngine;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值