结合之前所说的自定义流程的思路,分别是后台、前台、整合,之前的内容也分别进行了相关的练习和尝试,现在就该到了最后的整合了,依旧是以实现功能为目的,细节暂且不去管他。

因为我们实际项目后端用的是spring、spring mvc、mysql、mybatis,前台用的angular js,因此在整合时我也自己搭建使用了这样的环境。

1、 所使用的环境基础:eclipse4.4、mysql5.6、angularjs1.4、tomcat7、jdk1.7、maven3.2、spring4.0.9、activiit5.16、activiti-modeler5.16

2、 后端maven导包pom.xml文件如下:

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3. <modelVersion>4.0.0</modelVersion>
  4. <groupId>activitiTest1</groupId>
  5. <artifactId>activitiTest1</artifactId>
  6. <packaging>war</packaging>
  7. <version>0.0.1-SNAPSHOT</version>
  8. <name>activitiTest1 Maven Webapp</name>
  9. <url>http://maven.apache.org</url>
  10. <dependencies>
  11. <dependency>
  12. <groupId>junit</groupId>
  13. <artifactId>junit</artifactId>
  14. <version>4.11</version>
  15. </dependency>
  16. <dependency>
  17. <groupId>org.springframework</groupId>
  18. <artifactId>spring-beans</artifactId>
  19. <version>4.0.9.RELEASE</version>
  20. </dependency>
  21. <dependency>
  22. <groupId>org.springframework</groupId>
  23. <artifactId>spring-core</artifactId>
  24. <version>4.0.9.RELEASE</version>
  25. </dependency>
  26. <dependency>
  27. <groupId>org.springframework</groupId>
  28. <artifactId>spring-aop</artifactId>
  29. <version>4.0.9.RELEASE</version>
  30. </dependency>
  31. <dependency>
  32. <groupId>org.springframework</groupId>
  33. <artifactId>spring-context</artifactId>
  34. <version>4.0.9.RELEASE</version>
  35. </dependency>
  36. <dependency>
  37. <groupId>org.springframework</groupId>
  38. <artifactId>spring-webmvc</artifactId>
  39. <version>4.0.9.RELEASE</version>
  40. </dependency>
  41. <dependency>
  42. <groupId>org.springframework</groupId>
  43. <artifactId>spring-web</artifactId>
  44. <version>4.0.9.RELEASE</version>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.springframework</groupId>
  48. <artifactId>spring-aspects</artifactId>
  49. <version>4.0.9.RELEASE</version>
  50. </dependency>
  51. <dependency>
  52. <groupId>org.springframework</groupId>
  53. <artifactId>spring-expression</artifactId>
  54. <version>4.0.9.RELEASE</version>
  55. </dependency>
  56. <dependency>
  57. <groupId>org.springframework</groupId>
  58. <artifactId>spring-tx</artifactId>
  59. <version>4.0.9.RELEASE</version>
  60. </dependency>
  61. <dependency>
  62. <groupId>javax.servlet</groupId>
  63. <artifactId>javax.servlet-api</artifactId>
  64. <version>3.1.0</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>com.fasterxml.jackson.core</groupId>
  68. <artifactId>jackson-annotations</artifactId>
  69. <version>2.2.3</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>com.fasterxml.jackson.core</groupId>
  73. <artifactId>jackson-core</artifactId>
  74. <version>2.2.3</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>com.fasterxml.jackson.core</groupId>
  78. <artifactId>jackson-databind</artifactId>
  79. <version>2.2.3</version>
  80. </dependency>
  81. <dependency>
  82. <groupId>org.activiti</groupId>
  83. <artifactId>activiti-modeler</artifactId>
  84. <version>5.16</version>
  85. </dependency>
  86. <dependency>
  87. <groupId>org.activiti</groupId>
  88. <artifactId>activiti-engine</artifactId>
  89. <version>5.16</version>
  90. </dependency>
  91. <dependency>
  92. <groupId>org.activiti</groupId>
  93. <artifactId>activiti-explorer</artifactId>
  94. <version>5.16</version>
  95. </dependency>
  96. <dependency>
  97. <groupId>org.activiti</groupId>
  98. <artifactId>activiti-rest</artifactId>
  99. <version>5.16</version>
  100. </dependency>
  101. <dependency>
  102. <groupId>org.springframework</groupId>
  103. <artifactId>spring-context-support</artifactId>
  104. <version>4.0.9.RELEASE</version>
  105. </dependency>
  106. <dependency>
  107. <groupId>mysql</groupId>
  108. <artifactId>mysql-connector-<a href="http://lib.csdn.net/base/17" class="replace_word" title="Java EE知识库" target="_blank" style="color:#df3434; font-weight:bold;">java</a></artifactId>
  109. <version>5.1.34</version>
  110. </dependency>
  111. <dependency>
  112. <groupId>org.activiti</groupId>
  113. <artifactId>activiti-spring</artifactId>
  114. <version>5.16</version>
  115. </dependency>
  116. <dependency>
  117. <groupId>org.springframework</groupId>
  118. <artifactId>spring-jdbc</artifactId>
  119. <version>4.0.9.RELEASE</version>
  120. </dependency>
  121. <dependency>
  122. <groupId>org.springframework</groupId>
  123. <artifactId>spring-test</artifactId>
  124. <version>4.0.9.RELEASE</version>
  125. </dependency>
  126. <dependency>
  127. <groupId>org.activiti</groupId>
  128. <artifactId>activiti-bpmn-converter</artifactId>
  129. <version>5.16</version>
  130. </dependency>
  131. <dependency>
  132. <groupId>org.codehaus.jackson</groupId>
  133. <artifactId>jackson-core-asl</artifactId>
  134. <version>1.9.11</version>
  135. </dependency>
  136. <dependency>
  137. <groupId>org.codehaus.jackson</groupId>
  138. <artifactId>jackson-mapper-asl</artifactId>
  139. <version>1.9.11</version>
  140. </dependency>
  141. </dependencies>
  142. <build>
  143. <finalName>activitiTest1</finalName>
  144. </build>
  145. </project>

3、 web项目基础配置web.xml如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  4. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  5. id="WebApp_ID" version="2.5">
  6. <filter>
  7. <description>字符集过滤器</description>
  8. <filter-name>encodingFilter</filter-name>
  9. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  10. <init-param>
  11. <description>字符集编码</description>
  12. <param-name>encoding</param-name>
  13. <param-value>UTF-8</param-value>
  14. </init-param>
  15. </filter>
  16. <filter-mapping>
  17. <filter-name>encodingFilter</filter-name>
  18. <url-pattern>/*</url-pattern>
  19. </filter-mapping>
  20. <servlet>
  21. <servlet-name>RestletServlet</servlet-name>
  22. <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
  23. <init-param>
  24. <param-name>org.restlet.application</param-name>
  25. <param-value>org.activiti.rest.editor.application.ModelerRestApplication</param-value>
  26. </init-param>
  27. </servlet>
  28. <servlet-mapping>
  29. <servlet-name>RestletServlet</servlet-name>
  30. <url-pattern>/service/*</url-pattern>
  31. </servlet-mapping>
  32. <servlet>
  33. <servlet-name>springMVC</servlet-name>
  34. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  35. <init-param>
  36. <param-name>contextConfigLocation</param-name>
  37. <param-value>classpath:spring.xml</param-value>
  38. </init-param>
  39. </servlet>
  40. <servlet-mapping>
  41. <servlet-name>springMVC</servlet-name>
  42. <url-pattern>*.do</url-pattern>
  43. </servlet-mapping>
  44. <welcome-file-list>
  45. <welcome-file>activiti.html</welcome-file>
  46. <welcome-file>activiti.htm</welcome-file>
  47. <welcome-file>activiti.jsp</welcome-file>
  48. <welcome-file>default.html</welcome-file>
  49. <welcome-file>default.htm</welcome-file>
  50. <welcome-file>default.jsp</welcome-file>
  51. </welcome-file-list>
  52. lt;/web-app>

4、 其他依赖环境,如下图中红线框起来的部分:其中包括使用angularjs依赖的js,整合activiti-modeler依赖的文件和使用ueditor插件所需的文件。(具体的文件可参考之前的博客内容)

5、后台spring基础配置文件spring.xml如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. lt;beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:mvc="http://www.springframework.org/schema/mvc"
  6. xsi:schemaLocation="
  7. http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11. http://www.springframework.org/schema/mvc
  12. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  13. <context:annotation-config />
  14. <mvc:annotation-driven />
  15. <context:component-scan base-package="controllers" />
  16. <context:component-scan base-package="serviceImp" />
  17. <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
  18. <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
  19. <property name="url" value="jdbc:mysql://127.0.0.1:3306/testtu?useUnicode=true&characterEncoding=utf8" ></property>
  20. <property name="username" value="root" ></property>
  21. <property name="password" value="123456" ></property>
  22. </bean>
  23. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  24. <property name="dataSource" ref="dataSource"></property>
  25. </bean>
  26. <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  27. <property name="dataSource" ref="dataSource" />
  28. <property name="databaseSchemaUpdate" value="true" />
  29. <property name="jobExecutorActivate" value="false"/>
  30. <property name="history" value="full"/>
  31. <property name="transactionManager" ref="transactionManager" />
  32. <!-- 配置事务管理器,统一事务 -->
  33. <!-- 设置建表策略,如果没有表,自动创建表 -->
  34. </bean>
  35. <!-- 创建流程引擎对象 -->
  36. <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
  37. <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  38. </bean>
  39. <!-- 由流程引擎对象,提供的方法,创建项目中使用的Activiti工作流的Service -->
  40. <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  41. <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  42. <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  43. <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  44. <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
  45. <bean id="IdentityService" factory-bean="processEngine" factory-method="getIdentityService" />
  46. <!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
  47. <bean id="mappingJacksonHttpMessageConverter"
  48. class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
  49. <property name="supportedMediaTypes">
  50. <list>
  51. <value>text/html;charset=utf-8</value>
  52. </list>
  53. </property>
  54. </bean>
  55. <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
  56. <bean
  57. class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
  58. <property name="messageConverters">
  59. <list>
  60. <ref bean="mappingJacksonHttpMessageConverter" /><!-- json转换器 -->
  61. </list>
  62. </property>
  63. </bean>
  64. lt;/beans>

5、 整个项目结构如图:

activiti自定义流程之整合(一):整体环境配置的更多相关文章

  1. activiti自定义流程之整合(二):使用angular js整合ueditor创建表单

    注:整体环境搭建:activiti自定义流程之整合(一):整体环境配置 基础环境搭建完毕,接下来就该正式着手代码编写了,在说代码之前,我觉得有必要先说明一下activit自定义流程的操作. 抛开自定义 ...

  2. activiti自定义流程之整合(三):整合自定义表单创建模型

    本来在创建了表单之后应该是表单列表和预览功能,但是我看了看整合的代码,和之前没有用angularjs的基本没有什么变化,一些极小的变动也只是基于angularjs的语法,因此完全可以参考之前说些的表单 ...

  3. activiti自定义流程之整合(四):整合自定义表单部署流程定义

    综合前几篇博文内容,我想在整合这一部分中应该会有很多模块会跳过不讲,就如自定义表单的表单列表那一块,因为这些模块在整合的过程中都几乎没有什么改动,再多讲也是重复无用功. 正因为如此,在创建了流程模型之 ...

  4. activiti自定义流程之整合(五):启动流程时获取自定义表单

    流程定义部署之后,自然就是流程定义列表了,但和前一节一样的是,这里也是和之前单独的activiti没什么区别,因此也不多说.我们先看看列表页面以及对应的代码,然后在一步步说明点击启动按钮时如何调用自定 ...

  5. activiti自定义流程之整合(七):完成我的申请任务

    在上一篇的获得我的申请中,可以看到js代码中还包含了预览和完成任务的代码,既然上一篇已经罗列了相关代码,这里也就不重复. 那么需要补充的是,在上边的完成任务的js代码中,我们还调用了getTaskFo ...

  6. activiti自定义流程之整合(六):获取我的申请任务

    流程启动后,流程节点便进入到了任务相关的部分.可以看到我之前的做法是在启动节点就绑定了form表单,启动时就填写相关的数据.实际上在之前我的做法是不对开始节点做任何操作,知道任务节点的时候再填写相关的 ...

  7. activiti自定义流程之自定义表单(三):表单列表及预览和删除

    注:(1)环境配置:activiti自定义流程之自定义表单(一):环境配置 (2)创建表单:activiti自定义流程之自定义表单(二):创建表单 自定义表单创建成功,要拿到activiti中使用,自 ...

  8. activiti自定义流程之自定义表单(二):创建表单

    注:环境配置:activiti自定义流程之自定义表单(一):环境配置 在上一节自定义表单环境搭建好以后,我就正式开始尝试自己创建表单,在后台的处理就比较常规,主要是针对ueditor插件的功能在前端进 ...

  9. 关于我上传的activiti自定义流程demo的说明

    最近又收到了一些询问activiti的问题,其中好几个都是向我索要我上传的这个activiti自定义流程demo的数据库设计. 索要的多了,而我早就把这个库给删掉了,所以我便觉得有必要做一个说明: 我 ...

随机推荐

  1. OpenCV: Canny边缘检测算法原理及其VC实现详解(转载)

    原文地址:http://blog.csdn.net/likezhaobin/article/details/6892176 原文地址:http://blog.csdn.net/likezhaobin/ ...

  2. ZOJ 1243 URLs

    /*In the early nineties, the World Wide Web (WWW) was invented. Nowadays, most people think that the ...

  3. C++ Primer : 第十一章 : 关联容器之概述、有序关联容器关键字要求和pair类型

    标准库定义了两种主要的关联容器:map和set map中的元素时一些关键字-值(key-value)对,关键字起到索引的作用,值则表示与索引相关的数据.set中每个元素只包含一个关键字,可以完成高效的 ...

  4. 笨小猴 2008年NOIP全国联赛提高组

    题目描述 Description 笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼.但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大! 这种方法的具体描述如下:假设m ...

  5. java.lang.SecurityException: class "javax.servlet.FilterRegistration"(spark下maven)

    今天写spark例子用到maven,但是自己maven又不熟悉.遇到错误找了半天知道是(sevlet-api2.5 3.0)包冲突需要解决包之间依赖问题却不知道怎么下手.但是最终慢慢了解还是找到新手的 ...

  6. SQL书写规范及常用SQL语句

    常用的查询语句 SELECT * FROM 表名 [WHERE 条件 或 GROUP BY 字段名 HAVING] ORDER BY 字段名 排序方式 LIMIT 初始值,数量; SELECT fna ...

  7. IOS开发之SWIFT进阶部分

    概述 上一篇文章<iOS开发系列--Swift语言> 中对Swift的语法特点以及它和C.ObjC等其他语言的用法区别进行了介绍.当然,这只是Swift的入门基础,但是仅仅了解这些对于使用 ...

  8. iPad 2升级iOS 9的过程记录

    有一台老旧的iPad2,iOS版本还是5.1.1,现在好多软件都无法安装了. 决定升级到最新的操作系统,中间的过程,遇到的问题和解决办法如下: 据说升级到iOS 9以后就不好越狱了,不过我也就是用用一 ...

  9. some knowledge of maven {maven实战}

    maven是跨平台的,不仅是一个构建工具,也是一个可以管理依赖的工具.它最大化的消除了构件的重复,并且提供了中央仓库,能帮我们自动下载构件.------------------------------ ...

  10. 关于usr/bin/ld: cannot find -lxxx问题总结

    /usr/bin/ld: cannot find -lxxx问题总结   linux下编译应用程序常常会出现如下错误:     /usr/bin/ld: cannot find -lxxx       ...