1. 程式人生 > >3分鐘學會activiti專案整合

3分鐘學會activiti專案整合

整合步驟:

     1.匯入activiti jar包

activiti-5.16.4\wars\activiti-rest\WEB-INF\lib\activiti*.jar

mybatis-3.2.5.jar (儘量使用高版本)

joda-time-2.1.jar

有可能會缺失其他包,ClassNotFound 差什麼引入什麼?

Maven怎麼引入? 到中央倉庫,搜尋Activiti,拷貝pom的的程式碼端即可

     2.新增Activiti配置檔案-applicationContext-activiti.xml

-配置核心物件

使用者手冊中,第5章,前兩節。

     3.把Activiti配置檔案-applicationContext-activiti.xml整合到Spring

     4.測試

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">

                   <

property name="dataSource" ref="dataSource" />

                   <property name="transactionManager" ref="transactionManager" />

                   <

property name="databaseSchemaUpdate" value="true" />

         </bean>

         <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">

                   <property name="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" />

整合測試:

@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration("/applicationContext.xml")

public class ActivitiEnvTest {

         @Autowired

         private RepositoryService repositoryService;

         @Test

         public void test() {

                   System.out.println(repositoryService);

         }

}