05-Activiti7数据库的初始化

一、创建项目

创建一个maven工程。

如下图:
项目结构图

引入依赖:


    4.0.0

    com.beyondsoft.activiti
    activiti01
    1.0-SNAPSHOT

    
        1.6.6
        1.2.12
    

    

        
            org.activiti
            activiti-engine
            7.0.0.Beta1
        

        
            org.activiti
            activiti-spring
            7.0.0.Beta1
        

        
            org.activiti
            activiti-bpmn-model
            7.0.0.Beta1
        

        
            org.activiti
            activiti-bpmn-converter
            7.0.0.Beta1
        

        
            org.activiti
            activiti-json-converter
            7.0.0.Beta1
        

        
            org.activiti
            activiti-bpmn-layout
            7.0.0.Beta1
        

        
            org.activiti.cloud
            activiti-cloud-services-api
            7.0.0.Beta1
        

        
            mysql
            mysql-connector-java
            5.1.40
        

        
            junit
            junit
            4.12
        

        
        
            log4j
            log4j
            ${log4j.version}
        
        
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.slf4j
            slf4j-log4j12
            ${slf4j.version}
        
        

        
            org.mybatis
            mybatis
            3.4.5
        

        
            commons-dbcp
            commons-dbcp
            1.4
        
        
        
            commons-io
            commons-io
            2.0
        


    


    
        
            alfresco
            Activiti Releases
            https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/
            
                true
            
        
    


二、配置

引入日志文件;
配置 activiti.cfg.xml 文件
配置内容如下:




    
    
        
        
        
        
    
    

    
        
        


        
        
        
    

三、单元测试

代码如下:

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.junit.Test;

/**
 * @author ly
 * @Date: 2019/1/14 11:34
 * @description
 */
public class ActivitiTest {
    @Test
    public void testGenTable(){
        //创建ProcessEngineConfiguration
        ProcessEngineConfiguration configuration = ProcessEngineConfiguration
                        .createProcessEngineConfigurationFromResource("activiti.cfg.xml");
        //通过ProcessEngineConfiguration创建ProcessEngine,此时会创建数据库
        ProcessEngine processEngine =
                configuration.buildProcessEngine();
        System.out.println(processEngine);
    }
}

四、activiti7数据库生成

生成:25张工作流表
activiti7工作流表

你可能感兴趣的:(05-Activiti7数据库的初始化)