Activiti 生成25张表 附源码
发布者:IT人在线 | 发表时间:2018/11/30 9:38:42
Activiti 生成25张表 附源码
创建简单maven工程
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.itrzx.activiti</groupId> <artifactId>HelloWorld</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-bpmn-model</artifactId> <version>5.19.0.2</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> </dependencies> </project> |
测试类
@Test public void testCreateTable() { //获取流程引擎配置 ProcessEngineConfiguration pec=ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); pec.setJdbcDriver("com.mysql.jdbc.Driver"); pec.setJdbcUrl("jdbc:mysql://localhost:3306/db_activiti"); pec.setJdbcUsername("root"); pec.setJdbcPassword("root"); pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); ProcessEngine pe= pec.buildProcessEngine(); } |
用xml实现
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="jdbcUrl" value="jdbc:mysql://localhost:3306/db_activiti" /> <property name="jdbcDriver" value="com.mysql.jdbc.Driver" /> <property name="jdbcUsername" value="root" /> <property name="jdbcPassword" value="root" /> <property name="databaseSchemaUpdate" value="true" /> </bean> </beans>
|
方法
@Test public void testCreateTableHtml() { ProcessEngineConfiguration pec=ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml"); ProcessEngine pe= pec.buildProcessEngine(); } |