生成activiti的25张表

方法一:

/**
	 * 生成activiti需要得25张表
	 */
	@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("123456");
		
		/**
		 * 配置模式,true自动创建和更新表
		 */
		pec.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
		//获取流程引擎对象
		ProcessEngine pe = pec.buildProcessEngine();
		
	}

方法二:
用配置文件 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="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" />
 
    
  </bean>
 
</beans>
@Test
	public void testCreateTableWithXml() {
		//引擎配置
		ProcessEngineConfiguration pec = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
		//获取流程引擎对象
		ProcessEngine processEngine = pec.buildProcessEngine();
	}

猜你喜欢

转载自blog.csdn.net/qq_34721292/article/details/90108399
今日推荐