码迷,mamicode.com
首页 > 编程语言 > 详细

mybatis+springmvc+jbpm4整合配置

时间:2016-06-13 17:14:12      阅读:719      评论:0      收藏:0      [点我收藏+]

标签:

花了一段时间研究了下jbpm4,后来想把它整合在maven上,但是,后来发现,maven的中央仓库和私服上要么缺了jbpm4的jar包,要么springmvc的相关jar包版本跟原项目的版本匹配不上,所以干脆将jbpm4的jar包不使用maven管理,手工进行添加,成功完成整合。

 

关键配置文件如下:

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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="  
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd  
            http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd  
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
	default-autowire="byName" default-lazy-init="false">

	<context:property-placeholder location="classpath:db.properties" />

	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="${jdbc.driver}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
		<property name="maxActive" value="30" />
		<property name="maxIdle" value="5" />
	</bean>
	
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>


	<bean id="sqlSessionFactoryBuild" class="org.mybatis.spring.SqlSessionFactoryBean">
		<!--dataSource属性指定要用到的连接池 -->
		<property name="dataSource" ref="dataSource" />
		<!-- <property name="typeAliasesPackage" value="zttc.itat.user.po"/> -->
		<property name="configLocation" value="classpath:/mybatis-config.xml" />
	</bean>

	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="zttc.itat.user.dao" />
	</bean>
	
	<bean id="sessionFactoryJBPM"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />

		<property name="configLocation">
			<value>classpath:jbpm.hibernate.cfg.xml </value>
		</property>
		<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.OracleDialect
				</prop>

				<prop key="hibernate.query.factory_class">
					org.hibernate.hql.ast.ASTQueryTranslatorFactory
				</prop>

				<prop key="hibernate.show_sql">true </prop>
			</props>
		</property>
	</bean>

	<bean id="transactionManagerJBPM"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactoryJBPM" />
	</bean>

	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource" />
	</bean>

	<bean class="org.springframework.transaction.support.TransactionTemplate">
		<constructor-arg ref="transactionManagerJBPM"></constructor-arg>
	</bean>
	<!-- <tx:annotation-driven/> -->
	<!-- jbpm工作流 -->
	<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
		<property name="jbpmCfg" value="jbpm.cfg.xml"></property>
	</bean>
	<bean id="processEngine" factory-bean="springHelper"
		factory-method="createProcessEngine">
	</bean>

	<bean id="repositoryService" factory-bean="processEngine"
		factory-method="getRepositoryService" />


	<bean id="executionService" factory-bean="processEngine"
		factory-method="getExecutionService" />


	<bean id="taskService" factory-bean="processEngine"
		factory-method="getTaskService" />


	<bean id="historyService" factory-bean="processEngine"
		factory-method="getHistoryService" />


	<bean id="identityService" factory-bean="processEngine"
		factory-method="getIdentityService" />
</beans> 

 mybatis-config.xml配置文件如下:

 

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
	<settings>
		<setting name="cacheEnabled" value="true" />
		<setting name="lazyLoadingEnabled" value="false" />
		<setting name="aggressiveLazyLoading" value="true" />
		<setting name="logImpl" value="LOG4J" />
	</settings>

	<typeAliases>
		<package name="zttc.itat.user.po" />
	</typeAliases>
	
	<plugins>
		<plugin interceptor="com.github.pagehelper.PageHelper">
			<!-- 支持通过Mapper接口参数来传递分页参数 -->
			<property name="supportMethodsArguments" value="true" />
		</plugin>
	</plugins>

	<environments default="development">
		<environment id="development">
			<transactionManager type="JDBC">
				<property name="" value="" />
			</transactionManager>
			<dataSource type="UNPOOLED">
				<property name="driver" value="oracle.jdbc.driver.OracleDriver" />
				<property name="url" value="jdbc:oracle:thin:@//localhost:1521/orcl" />
				<property name="username" value="root" />
				<property name="password" value="root" />
			</dataSource>
		</environment>
	</environments>

	<databaseIdProvider type="DB_VENDOR">
		<property name="Oracle" value="oracle" />
	</databaseIdProvider>

	<mappers>
		<mapper resource="zttc/itat/user/mapper/TUserMapper.xml" />
		<mapper resource="zttc/itat/user/mapper/Jbpm4DeploymentMapper.xml" />
		<mapper resource="zttc/itat/user/mapper/TLeaveApplyMapper.xml" />
	</mappers>
</configuration>

 

mybatis+springmvc+jbpm4整合配置

标签:

原文地址:http://www.cnblogs.com/ycblus/p/5581181.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!