Spring boot2.0和Activiti 6.0的集成

  1. 在 pom.xml里引入以下依赖
        
            org.activiti
            activiti-spring-boot-starter-basic
            6.0.0
        

    如果项目里引入了mapper,则需要再mapper依赖中排除persistence-api,否则会以下的错误:

Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configuration.

    2.在配置文件中,设置

spring:
    activiti:
      check-process-definitions: false

    如果不设置,则会报错

java.io.FileNotFoundException: class path resource [processes/] cannot be resolved to URL because it does not exist

    另外在resources目录下添加processes文件夹,并且在该目录下放bpmn文件或者bpmn20.xml文件,启动也不会报上述错误。

    此外,还有一个属性是 database-schema-update,可选值为: false,true,create-drop,drop-create,代码里写的默认为true。为什么要强调是代码里呢。因为官方文档,写的默认为false。

     为true表示activiti会对数据库中的表进行更新操作,如果不存在,则进行创建。这个比较符合需要,而且是默认值,所以就不需要设置了。

     3.在启动类上排除SecurityAutoConfiguration类

@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
    如果不加,则报错
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
   

你可能感兴趣的:(activiti)