spring整合activiti配置文件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37279783/article/details/88802526
//spring配置文件
<import resource="spring-activiti.xml"/>

//spring-activiti.xml内容
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSource"></property>//数据源
        <property name="transactionManager" ref="transactionManager"></property>//事务
        <property name="databaseSchemaUpdate" value="true"></property>
    </bean>

    <bean id="processEngineFactory" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration"></property>
    </bean>

    //注入activiti自带的service
    <bean id="repositoryService" factory-bean="processEngineFactory" factory-method="getRepositoryService" />
    <bean id="runtimeService" factory-bean="processEngineFactory" factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngineFactory" factory-method="getTaskService" />
    <bean id="historyService" factory-bean="processEngineFactory" factory-method="getHistoryService" />
</beans>

在控制层和事务层可以通过注入activiti自带的service进行流程操作
    @Autowired
    RuntimeService runtimeService;
    @Autowired
    RepositoryService repositoryService;
    @Autowired
    TaskService taskService;
    @Autowired
    HistoryService historyService;

猜你喜欢

转载自blog.csdn.net/qq_37279783/article/details/88802526
今日推荐