解决jbpm4.4和spring多数据源的问题

主要是项目配了多个sessionfactory,后台一直报警告
Multiple Spring beans found for type interface org.hibernate.SessionFactory returning the first one found
解决:
扩展springhelper

原帖
解决jbpm4.4和spring多数据源的问题
http://www.oecp.cn/hi/yongtree/blog/2562
引用

一、扩展SpringHelper,添加setSessionFactory,指定sessionfactory注入

public class ProcessEngineFactoryBean extends SpringHelper {
     
    protected SessionFactory sessionFactory;
     
    public void setSessionFactory(SessionFactory sessionFactory) {
    this.sessionFactory = sessionFactory;
    }
     
    public ProcessEngine createProcessEngine() {
    processEngine = new ConfigurationImpl().springInitiated(
    applicationContext).setResource(jbpmCfg)
    .setHibernateSessionFactory(sessionFactory)
    .buildProcessEngine();
    return processEngine;
    }
     
    }



   


 <!-- jbpm配置 cn.oecp.jbpm4.cfg.pvm.ProcessEngineFactoryBean上面已经定义-->
    <bean id="springHelper" class="com.dawn.jbpm4.cfg.pvm.ProcessEngineFactoryBean">
    <property name="jbpmCfg" value="com/dawn/jbpm4/cfg/jbpm.cfg.xml"></property>
    <property name="sessionFactory">
    <ref local="sessionFactory-jbpm" />
    </property>
    </bean>

 


另外:

jBPM-4.4:与Spring集成配置
http://blog.csdn.net/shirdrn/article/details/6194954

http://jbpm.group.iteye.com/group/topic/17403

你可能感兴趣的:(Spring多数据源)