SSH+activity工作流集成开发「建议收藏」

SSH+activity工作流集成开发「建议收藏」一直没有更新最近,把以前的资料整理下。SSH的集成配置清查看上一篇struts-2.3.24+spring-framework-4.1.6.RELEASE+hibernate-release-4.3.10.Final集成开发导入activity工作流需要的jaractiviti-bpmn-converter-5.16.4.jaractiviti-bpmn-layout-5

大家好,又见面了,我是你们的朋友全栈君。

一直没有更新最近,把以前的资料整理下。
SSH的集成配置清查看上一篇

struts-2.3.24+spring-framework-4.1.6.RELEASE+hibernate-release-4.3.10.Final
集成开发

导入activity工作流需要的jar
activiti-bpmn-converter-5.16.4.jar
activiti-bpmn-layout-5.16.4.jar
activiti-bpmn-model-5.16.4.jar
activiti-camel-5.16.4.jar
activiti-cdi.jar
activiti-common-rest-5.16.4.jar
activiti-crystalball-5.16.4.jar
activiti-cxf-5.16.4.jar
activiti-diagram-rest-5.16.4.jar
activiti-engine-5.16.4.jar
activiti-explorer-5.16.4.jar
activiti-image-generator-5.16.4.jar
activiti-json-converter-5.16.4.jar
activiti-ldap-5.16.4.jar
activiti-modeler-5.16.4.jar
activiti-mule-5.16.4.jar
activiti-osgi-5.16.4.jar
activiti-process-validation-5.16.4.jar
activiti-simple-workflow-5.16.4.jar
activiti-rest-5.16.4.jar
activiti-spring-5.16.4.jar

添加配置文件:新建activiti.cfg.xml文件

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    <!-- spring负责创建流程引擎的配置文件 -->
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <!-- 数据源 -->
        <property name="dataSource" ref="dataSource" />
        <!-- 配置事务管理器,统一事务 -->
        <property name="transactionManager" ref="txManager" />
        <!-- 设置建表策略,如果没有表,自动创建表 -->
        <property name="databaseSchemaUpdate" value="true" />
    </bean>
    <!-- 创建流程引擎对象 -->
    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration" />
    </bean>

    <!-- 相当于下面的代码 RepositoryServicie repositoryService = processEngine.getRepositoryService(); RuntimeServicie repositoryService = processEngine.getRuntimeServicie(); TaskServicie taskServicie = processEngine.getTaskServicie(); HistoryServicie historyServicie = processEngine.getHistoryServicie(); -->
    <!-- 由流程引擎对象,提供的方法,创建项目中使用的Activiti工作流的Service -->
    <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="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
    <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
</beans>

到此配置完成使用的时候可使用注解注入activity的

//获取流程引擎对象,通过流程引擎对象可以获取其他几个服务对象
@Resource
private ProcessEngine processEngine;
//获取部署流程对象服务,通过repositoryService可以部署流程信息,查询流程信息
@Resource
private  RepositoryService repositoryService;
//获取流程运行时对象,可通过查询正在执行中的流程信息
@Resource
private RuntimeService  runtimeService;
//任务服务对象,可通过他查询任务信息
@Resource
private TaskService taskService;
//历史服务对象,通过他查询历史流程信息
@Resource
private HistoryService  historyService;

通过

<import resource="classpath:activiti.cfg.xml" />

导入到applicationContext.xml配置文件,交给spring管理。详细查看applicationContext.xml配置。

接下来是activity的基本使用。

如下配置applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 1、自动扫描与装配bean -->
<context:component-scan base-package="cn.ssha"></context:component-scan>
<!-- 导入外部的配置文件 -->
<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 配置数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="${jdbcUrl}"></property>
<property name="driverClass" value="${driverClass}"></property>
<property name="user" value="${user}"></property>
<property name="password" value="${password}"></property>
<!-- 其他配置 -->
<!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
<property name="initialPoolSize" value="3"></property>
<!--连接池中保留的最小连接数。Default: 3 -->
<property name="minPoolSize" value="3"></property>
<!--连接池中保留的最大连接数。Default: 15 -->
<property name="maxPoolSize" value="5"></property>
<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
<property name="acquireIncrement" value="3"></property>
<!-- 控制数据源内加载的PreparedStatements数量。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0 -->
<property name="maxStatements" value="8"></property>
<!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
<property name="maxStatementsPerConnection" value="5"></property>
<!--最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="maxIdleTime" value="1800"></property>
</bean>
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<!-- 指定hibernate的配置路径 -->
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<property name="dataSource" ref="dataSource"></property>
<!-- 配置c3p0数据库连接池 <property name="dataSource"> <bean class="com.mchange.v2.c3p0.ComboPooledDataSource"> 数据库连接信息 <property name="jdbcUrl" value="${jdbcUrl}"></property> <property name="driverClass" value="${driverClass}"></property> <property name="user" value="${user}"></property> <property name="password" value="${password}"></property> 其他配置 初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 <property name="initialPoolSize" value="3"></property> 连接池中保留的最小连接数。Default: 3 <property name="minPoolSize" value="3"></property> 连接池中保留的最大连接数。Default: 15 <property name="maxPoolSize" value="5"></property> 当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 <property name="acquireIncrement" value="3"></property> 控制数据源内加载的PreparedStatements数量。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0 <property name="maxStatements" value="8"></property> maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 <property name="maxStatementsPerConnection" value="5"></property> 最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 <property name="maxIdleTime" value="1800"></property> </bean> </property> -->
<!-- <property name="mappingResources"> <list> <value>cn/ssha/oa/doman/Product.hbm.xml</value> <value>cn/ssha/oa/doman/Employee.hbm.xml</value> <value>cn/ssha/oa/doman/LeaveBill.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect hibernate.show_sql=true hibernate.hbm2ddl.auto=update hibernate.temp.use_jdbc_metadata_defaults=false </value> </property> -->
</bean>
<!-- 配置声名式事务管理(采用注解的方式) -->
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="txManager" />
<!-- 配置基础的Dao,在其他的DAO中只需要继承即可 -->
<bean id="baseDao" abstract="true">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<import resource="classpath:activiti.cfg.xml" />
</beans>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/144877.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • idea2021.11激活[最新免费获取]

    (idea2021.11激活)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。https://javaforall.cn/100143.htmlIntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,上面是详细链接哦~6EK6WKOHUX-eyJsaWNlbnNlSWQiOi…

  • vue生命周期函数_有哪些vue生命周期函数

    vue生命周期函数_有哪些vue生命周期函数生命周期函数生命周期函数代表的是Vue实例,或者是Vue组件,在网页中各个生命阶段所执行的函数。生命周期函数可以分为创建阶段和运行期间以及销毁期间。其中创建期间的函数有beforeCreate、c

  • msf 漏洞扫描_漏洞扫描方案

    msf 漏洞扫描_漏洞扫描方案目录1msfconsole介绍1msfconsole介绍msfconsole简称msf是一款常用的安全测试工具,包含了常见的漏洞利用模块和生成各种木马,其提供了一个一体化的集中控制台,通过msfconsole,你可以访问和使用所有的metaslopit插件,payload,利用模块,post模块等等。msfconsole还有第三方程序的接口,比如nmap、sqlmap等,可以直接在msfconsole里面使用。kali可直接在命令使用:msfconsoleMsfconsole的系统

  • IOS 语法 – 关于 NStimer 中 scheduledTimerWithTimeInterval方法传参的问题「建议收藏」

    IOS 语法 – 关于 NStimer 中 scheduledTimerWithTimeInterval方法传参的问题「建议收藏」使用NSTimerscheduledTimerWithTimeInterval:target:selector:userInfo:repeats:的时候有两个地方需要注意。首先select

  • 解决Pycharm运行速度慢的方法「建议收藏」

    解决Pycharm运行速度慢的方法「建议收藏」用惯了Jupyter,Spyder的开发者切换到Pycharm时,发现不论是打开IDE的速度,还是调试的速度都慢的让人想砸电脑,笔者在这花了好长时间生闷气,最终总结了几个坑来解决运行速度慢的问题,希望能帮到大家。1.扩大Pycharm运行内存打开后找到-Xms-Xmx两行,增加运行内存(根据电脑配置,笔者是8G内存),可明显改善打开IDE的速度2.新建工程选择Python解释器笔者常用Anaconda,因此选用了它3.解决运行时查看变量速度慢的方法File->Setting-&gt

  • shell编程100例(附PDF下载)「建议收藏」

    shell编程100例(附PDF下载)「建议收藏」1、编写helloworld脚本#!/bin/bash#编写helloworld脚本echo”HelloWorld!”2、通过位置变量创建Linux系统账户及密码#!/bin/bash#通过位置变量创建Linux系统账户及密码#$1是执行脚本的第一个参数,$2是执行脚本的第二个参数useradd”$1″echo”…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号