目录
1.写在开头
学习这篇文档需要具备:Java基础,数据库基础(mysql Oracle DB2等均可)
该文章不适合:不会安装Eclipse插件
Activiti官方主页:http://www.activiti.org/index.html
2.Eclipse上安装Activiti插件
1.在线安装,百度Eclipse安装插件,地址输入:http://activiti.org/designer/update/
2.下载好activiti相关jar,拷贝进入eclipse文件夹的features和plugins
3.activiti.cfg.xml
- 在src/test/resources下创建一个xml文件 名字是: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">
<!-- MySQL 任选一个-->
<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="123456" />
<property name="databaseSchemaUpdate" value="true" />
<!-- Oracle -->
<!-- <property name="url" value="j=dbc:oracle:thin:@localhost:1521:db_activiti" />
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="username" value="root" />
<property name="password" value="123456" /> -->
</bean>
</beans>
- 创建测试类,读取文件,生成28张表
/**
* 使用xml配置 简化
*/
@Test
public void testCreateTableWithXml(){
// 引擎配置
ProcessEngineConfiguration pec=ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
// 获取流程引擎对象
ProcessEngine processEngine=pec.buildProcessEngine();
}
- 运行测试类,数据库会生成下面28张表