spring boot+activity工做流學習環境搭建

一、新建spring boot項目java



二、加依賴mysql

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>


    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-engine</artifactId>
        <version>6.0.0</version>
    </dependency>
</dependencies>複製代碼

三、resources目錄下新建activiti.cfg.xml 配置文件(填寫數據庫地址,帳號密碼)web

<?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://xxx.xxx.xxx.xxx:3306/activity_test?useSSL=FALSE&amp;characterEncoding=utf8"/>
        <property name="jdbcDriver" value="com.mysql.jdbc.Driver"/>
        <property name="jdbcUsername" value="xxx"/>
        <property name="jdbcPassword" value="xxx"/>
        <property name="databaseSchemaUpdate" value="true"/>
    </bean>

</beans>複製代碼

四、測試文件下運行下面方法後,去數據庫看,生成工做流引擎表spring


@Test
public void activitiTable() {
    ProcessEngineConfiguration cfg = ProcessEngineConfiguration
            .createProcessEngineConfigurationFromResource("activiti.cfg.xml");
    ProcessEngine processEngine = cfg.buildProcessEngine();
}複製代碼



OK,sql

相關文章
相關標籤/搜索