如何将activiti explorer与spring融为一体

时间:2016-04-08 09:14:56

标签: java spring activiti bpmn

我在我的项目中使用了activiti。当我运行项目时,它会在我的(mysql)数据库中创建所有的activiti表。我想使用activeiti数据库的嵌入H2。现在我的问题是如何将activiti与spring集成,当我处理任务时,所有信息都保存在embed数据库中?

3 个答案:

答案 0 :(得分:2)

在applicationContext.xml文件中添加它

<!-- Activiti Configuration -->
    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration" />
    </bean>

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSourceActiviti" />
        <property name="transactionManager" ref="ActivitiTransactionManager" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="jobExecutorActivate" value="true" />
        <!-- <property name="deploymentResources" value="classpath*:diagrams/*.bpmn20.xml" 
            /> -->
        <!-- <property name="deploymentResources" value="classpath*:/diagrams/*.bpmn" 
            /> -->
    </bean>

    <bean id="dataSourceActiviti"
        class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClassName" value="org.h2.Driver" />
        <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
        <property name="username" value="sa" />
        <property name="password" value="" />
    </bean>

    <bean id="ActivitiTransactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSourceActiviti" />
    </bean>

    <bean id="repositoryService" factory-bean="processEngine"
        factory-method="getRepositoryService" />
    <bean id="runtimeService" factory-bean="processEngine"
        factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngine"
        factory-method="getTaskService" />
    <bean id="historyService" factory-bean="processEngine"
        factory-method="getHistoryService" />
    <bean id="managementService" factory-bean="processEngine"
        factory-method="getManagementService" />
    <bean id="formService" factory-bean="processEngine"
        factory-method="getFormService" />
    <bean id="identityService" factory-bean="processEngine"
        factory-method="getIdentityService" />

答案 1 :(得分:0)

研究Activiti的文档非常好(link)。 我正在分享一个link示例,其中在spring mvc项目中使用了activiti。

答案 2 :(得分:0)

对于您的情况,您可以参考activiti http://www.activiti.org/userguide/#databaseConfiguration部分