Activiti5.22开发 数据库初始化

1 maven 项目增加依赖
         < dependency >
< groupId >org.activiti groupId >
         < artifactId >activiti-engine artifactId >
         < version >5.21.0 version >
         dependency >

2 在src\main\resources增加文件activiti.cfg.xml
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.engine.impl.cfg.StandaloneProcessEngineConfiguration" >
< property name= "databaseType" value= "mysql" > property >
< property name= "jdbcUrl" value= "jdbc:mysql://localhost:3306/springmvc?useUnicode=true&characterEncoding=utf-8" > property >
< property name= "jdbcDriver" value= "com.mysql.jdbc.Driver" > property >
< property name= "jdbcUsername" value= "root" > property >
< property name= "jdbcPassword" value= "wmzycn" > property >
bean >
beans >

4 编写数据库初始化类
package com.springmvc.test;

import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;

/**
* 创建activiti的数据库
* @author admin
*
*/
public class DBSchemaCreate {

     public static void main( String[] args) {
     ProcessEngineConfiguration
     .createProcessEngineConfigurationFromResourceDefault()
     .setDatabaseSchemaUpdate(ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE)
     .buildProcessEngine();
     }
    
}

5 run as  DBSchemaCreate 生成 21张表
 

你可能感兴趣的:(Activiti)