Learning Activiti5.13 and SPRINGMVC integration, self-study phase 001

Source: Internet
Author: User
Tags jbpm

The company has a business need to use to workflow this thing, has not been contacted, the leadership gave some time for me to study the first. Initially intended to use JBPM, but later learned to find that seemingly jbpm default support for Hibernate, our project uses MyBatis to do the persistence. Later asked friends in addition to jbpm there are other workflow development plugin did not. Friend said Activiti very good, I found a bit of information on the internet really good, feel lighter than jbpm, packaging than jbpm also mature a lot, with spring, MyBatis is well integrated together, so on learning Activiti, Activiti is also a process based on JBPM.

1. First, go to the official website to download the Activiti plugin package:

Website address: Download Activiti plug-in package

2. After downloading the plugin, you need to integrate with eclipse or other IDE, I use Eclipse, specific plug-in installation address on-line query. After the plugin is installed, click Eclipse window--Preferences to see

3. Initialize the Activiti through spring, which is mainly to add the following mapping information to the spring application.xml,application.xml configuration file:

<!--load Activiti engine--<bean id= "Processengine" class= "Org.activiti.spring.ProcessEngineFactoryBean" >  <property name= "processengineconfiguration" ref= "processengineconfiguration"/> </bean> <bean Id= "Processengineconfiguration" class= "org.activiti.spring.SpringProcessEngineConfiguration" > <property n         Ame= "DataSource" ref= "DataSource"/> <property name= "TransactionManager" ref= "TransactionManager"/> <property name= "Databaseschemaupdate" value= "true"/> <property name= "jobexecutoractivate" value= "FAL Se "/> </bean> <!--activiti Various service Interfaces--<bean id=" Repositoryservice "factory-bean=" proces Sengine "factory-method=" Getrepositoryservice "/> <bean id=" Runtimeservice "factory-bean=" processEngine "facto ry-method= "Getruntimeservice"/> <bean id= "Taskservice" factory-bean= "Processengine" factory-method= " Gettaskservice "/> <bean Id= "Historyservice" factory-bean= "Processengine" factory-method= "Gethistoryservice"/> <bean id= "managementSe Rvice "factory-bean=" Processengine "factory-method=" Getmanagementservice "/>

4. Data Source Configuration

5. When the application server starts, it will automatically create the related tables required by Activiti:


6. You can write a test small content:

Processengine PE = processengines.getdefaultprocessengine (); SYSTEM.OUT.PRINTLN (PE); Repositoryservice reposit = Pe.getrepositoryservice ();D Eploymentbuilder deploy = Reposit.createdeployment (); Deploy.addclasspathresource ("/MYPROCESS.BPMN");d Eploy.deploy ();        Runtimeservice Runtimeservice = Pe.getruntimeservice ();         Runtimeservice.startprocessinstancebykey ("Scripttask1");//Start the process, the ID must be consistent with your configuration          System.out.println ("OK ...");  

Run output:

Test

Ok......


I also in the study, has the wrong place also hoped that the elder brother guides a ha ~





Learning Activiti5.13 and SPRINGMVC integration, self-study phase 001

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.