Activiti6.0实战-目录 一整套哦
spring-boot:2.4.0
activiti-spring-boot-starter-basic:6.0.0
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.4.0version>
<relativePath/>
parent>
<properties>
<java.version>1.8java.version>
properties>
<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
<dependency>
<groupId>org.activitigroupId>
<artifactId>activiti-spring-boot-starter-basicartifactId>
<version>6.0.0version>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
dependency>
dependencies>
spring:
datasource:
username: root
password: 123456
url: jdbc:m如下ysql://localhost:3306/workflow?serverTimezone==GMT%2B8&characterEncoding=utf8&useSSL=false
activiti:
# 自动部署验证设置:true-开启(默认)、false-关闭
check-process-definitions: false
#配置项可以设置流程引擎启动和关闭时数据库执行的策略
database-schema-update: true
#保存历史数据级别设置为full最高级别,便于历史数据的追溯
history-level: full
spring.activiti.database-schema-update
配置项可以设置流程引擎启动和关闭时数据库执行的策略,可以选择四种模式
注意
第一次启动程序后,数据库会自动生成关于activiti28张表,可以关闭程序,修改配置项
#每次应用启动不检查Activiti数据表是否存在及版本号是否匹配,提升应用启动速度 spring.activiti.database-schema-update=false
spring.activiti.history-level
对于历史数据,保存到何种粒度,Activiti提供了history-level属性对其进行配置。history-level属性有点像log4j的日志输出级别,该属性有以下四个值:
import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class WorkflowApplication {
public static void main(String[] args) {
SpringApplication.run(WorkflowApplication.class, args);
}
}
成功之后,数据库会生成28张表
错误:Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:102) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:81) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:169) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:150) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:348) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:252) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:285) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:99) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:751) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:569) ~[spring-context-5.3.1.jar:5.3.1]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) [spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) [spring-boot-2.4.0.jar:2.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) [spring-boot-2.4.0.jar:2.4.0]
at com.laker.workflow.WorkflowApplication.main(WorkflowApplication.java:10) [classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_102]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_102]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_102]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_102]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_102]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_102]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:284) ~[spring-core-5.3.1.jar:5.3.1]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324) ~[spring-core-5.3.1.jar:5.3.1]
... 25 common frames omitted
springboot2.0不能与activiti6.0.0直接集成使用,因为activiti6.0.0出来的时候springboot2.0还没有出来,activiti6.0.0 支持springboot1.2.6以上,2.0.0以下的版本。
解决:
1:将springboot2.0降级为原来的1.X版本
2:在springboot启动类上添加 (推荐)
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
参考:
Activiti实战
Activiti权威指南
疯狂工作流讲义
https://github.com/Activiti/activiti-examples
https://github.com/henryyan/kft-activiti-demo
QQ群【837324215】
关注我的公众号【Java大厂面试官】,回复:架构、资源等关键词(更多关键词,关注后注意提示信息)获取更多免费资料。
公众号也会持续输出高质量文章,和大家共同进步。