table of Contents
--1.Spring integrated Activiti
--2.SpringBoot integrated Activiti (use starter)
--3.SpringBoot integrated Activiti (to create a manual configuration class @Configuration)
1> Modify pom.xml
<activiti.version>6.0.0</activiti.version> <!-- activiti集成 --> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>${activiti.version}</version> </dependency> <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring</artifactId> <version>${activiti.version}</version> </dependency>
2> Create application-activiti.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" 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 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop HTTP: // the WWW .springframework.org / Schema / AOP / Spring-aop.xsd " > < the bean ID =" processEngineConfiguration " class =" org.activiti.spring.SpringProcessEngineConfiguration " > <-! implantation data source -> < Property name =" dataSource " ref =" dataSource " > </ Property > <-! the matters to spring to manage -> <property name="transactionManager" ref="transactionManager" /> <-! Flase: default. activiti at startup, it will contrast the saved version of a database table, or if there is no table version does not match, will throw an exception. true: activiti will update the operation of all tables in the database. If the table does not exist, it is created automatically. create_drop: Create a table in the activiti start, remove the table when you close (you must manually shut down the engine, you can delete the table). drop-create: erase the original table when activiti start, and then create a new table (no need to manually shut off the engine). -> < Property name = "databaseSchemaUpdate" value = "to true" > </ Property > </ bean > <-! Create Process engine object -> < bean the above mentioned id = "processEngine" class = "org.activiti.spring .ProcessEngineFactoryBean " > <="processEngineConfiguration" ref="processEngineConfiguration" /> </bean> <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /> <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /> <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /> <bean id="formService" factory-bean="processEngine" factory-method="getFormService" /> <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /> <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /> <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" /> </beans>
4> to start the project test