1.添加依赖
<!--activity依赖--> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-model</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-converter</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-json-converter</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-layout</artifactId> <version>5.19.0.2</version> </dependency> <!--activiti和Spring整合依赖--> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring</artifactId> <version>5.19.0.2</version> </dependency>
activity版本 5.19
2.在springmvc的配置文件中加入文件上传解析器配置
用于文件上传
<!-- 文件上传解析器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设置默认编码 -->
<property name="defaultEncoding" value="utf-8"></property>
<!-- 上传最大大小10M-->
<property name="maxUploadSize" value="10242440"></property>
</bean>
3.activity配置
<?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 name="transactionManager" ref="transactionManager" /> <!--设置数据可schema更新方式--> <property name="databaseSchemaUpdate" value="true" /> </bean> <!-- 定义流程引擎 --> <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"> <property name="processEngineConfiguration" ref="processEngineConfiguration" /> </bean> <!-- 定义Service服务 --> <!--工作流仓储服务--> <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="identityService" factory-bean="processEngine" factory-method="getIdentityService"/> <bean id="formService" factory-bean="processEngine" factory-method="getFormService"></bean> </beans>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?