SpringCloud 2.x整合Activiti 7

本文讲述了在SpringBoot项目中引入Activiti框架时遇到的依赖冲突问题,涉及Shiro和ActivitiSpringSecurity的配置冲突,以及如何通过排除mybatis和在启动类添加@Primary注解解决启动时的bean定义冲突。还介绍了流程图中的候选人和任务回撤概念。
摘要由CSDN通过智能技术生成

开发

引入依赖

首先需要引入依赖,同时需要排除一些依赖来解决冲突。

        <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-spring-boot-starter</artifactId>
            <version>7.1.0.M4</version>
            <exclusions>
                <!-- 由于activiti7是使用mybatis作为orm框架,我这里整合mybatis-plus,所以需要排除mybatis -->
                <exclusion>
                    <groupId>org.mybatis</groupId>
                    <artifactId>mybatis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.el</groupId>
                    <artifactId>el-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

整合错误汇总

启动错误一

  • 错误描述:
Description:
 
The bean 'securityManager', defined in class path resource [org/activiti/core/common/spring/security/config/ActivitiSpringSecurityAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/lidomtech/erp/admin/modules/security/config/ShiroConfig.class] and overriding is disabled.
 
Action:
 
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
 
Disconnected from the target VM, address: '127.0.0.1:5571', transport: 'socket'
 
Process finished with exit code 0
  • 解决错误:
    Activiti默认引入了SpringSecurity,所以在启动类上排除SecurityAutoConfiguration.class、ManagementWebSecurityAutoConfiguration.class
@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class, org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration.class})

启动错误二

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method springAsyncExecutor in org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration required a single bean, but 3 were found:
	- jmReportTaskExecutor: defined by method 'asyncServiceExecutor' in class path resource [org/jeecg/modules/jmreport/config/JmReportExecutorConfig.class]
	- taskExecutor: defined by method 'taskExecutor' in class path resource [org/activiti/spring/boot/ProcessEngineAutoConfiguration.class]
	- taskScheduler: defined by method 'taskScheduler' in class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.class]


Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

解决方案在启动类加入如下代码

    @Primary
    @Bean
    public TaskExecutor primaryTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        return executor;
    }

流程图配置

代理人

候选人

一个任务可以设置多个候选人,候选人在业务上指的是有权对该任务进行操作的群体。
某个候选人签收后,其他候选人就看不到该任务

候选组

任务回撤
https://blog.csdn.net/weixin_42174333/article/details/115632881

https://blog.csdn.net/wufaqidong1/article/details/128427063

Service接口作用
RepositoryService流程仓库Service,用于管理流程仓库,例如,部署、删除、读取流程资源
IdentifyService身份Service,可以管理和查询用户、组之间的关系
RuntimeService运行时Service,可以处理所有正在运行状态的流程实例、任务等
TaskService任务Service,用于管理、查询任务,例如,签收、办理、指派
FormService表单Service,用于读取和流程、任务相关的表单数据
HistoryService历史Service,可以查询所有历史数据,例如,流程实例、任务、活动、变量、附件等
ManagementService引擎管理Service,和具体业务无关,主要是可以查询引擎配置、数据库、作业等
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值