一、导入jar包
activation-1.1.jar
activiti-bpmn-converter-5.13.jar
activiti-bpmn-layout-5.13.jar
activiti-bpmn-model-5.13.jar
activiti-common-rest-5.13.jar
activiti-engine-5.13.jar
activiti-json-converter-5.13.jar
activiti-rest-5.13.jar
activiti-simple-workflow-5.13.jar
activiti-spring-5.13.jar
aopalliance-1.0.jar
commons-dbcp-1.4.jar
commons-email-1.2.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.4.jar
commons-pool-1.5.4.jar
h2-1.3.170.jar
hamcrest-core-1.3.jar
jackson-core-asl-1.9.9.jar
jackson-mapper-asl-1.9.9.jar
javaGeom-0.11.0.jar
jcl-over-slf4j-1.7.2.jar
jgraphx-1.10.4.2.jar
joda-time-2.1.jar
junit-4.11.jar
log4j-1.2.17.jar
mail-1.4.1.jar
mybatis-3.2.2.jar
mysql-connector-java.jar
org.restlet-2.0.15.jar
org.restlet.ext.fileupload-2.0.15.jar
org.restlet.ext.jackson-2.0.15.jar
org.restlet.ext.servlet-2.0.15.jar
slf4j-api-1.7.2.jar
slf4j-log4j12-1.7.2.jar
spring-aop-3.1.2.RELEASE.jar
spring-asm-3.1.2.RELEASE.jar
spring-beans-3.1.2.RELEASE.jar
spring-context-3.1.2.RELEASE.jar
spring-core-3.1.2.RELEASE.jar
spring-expression-3.1.2.RELEASE.jar
spring-jdbc-3.1.2.RELEASE.jar
spring-orm-3.1.2.RELEASE.jar
spring-tx-3.1.2.RELEASE.jar
二、配置数据库连接创建表
public class TestActiviti {
/**使用代码创建工作流需要的23张表*/
@Test
public void createTable(){
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
//连接数据库的配置
processEngineConfiguration.setJdbcDriver("com.mysql.jdbc.Driver");
processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf8");
processEngineConfiguration.setJdbcUsername("root");
processEngineConfiguration.setJdbcPassword("root");
/**
public static final String DB_SCHEMA_UPDATE_FALSE = "false";不能自动创建表,需要表存在
public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";先删除表再创建表
public static final String DB_SCHEMA_UPDATE_TRUE = "true";如果表不存在,自动创建表
*/
processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
//工作流的核心对象,ProcessEnginee对象
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
System.out.println("processEngine:"+processEngine);
}
}