基于jeasyframe框架进行开发项目实例

实例下载地址:http://git.oschina.net/jeasyframe/jeasyframe

实例中主要是底层代码的实例,对于action和jsp页面,可以直接仿照jeasyframe框架中的代码进行开发.相信有了这个实例之后,你会很快上手的.

唠叨一句,扩展开发的话,别忘了把hibernate实体映射文件放到applicationContext-common.xml中. struts配置文件,别忘了引入你自己的struts分支哦.

好啦,有不懂的继续留言给我吧,我会及时回复的.

<!-- lang: xml -->
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"  
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"  
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<!-- 扫描指定包 -->
<context:component-scan base-package="com.djzhou.*" />
<context:annotation-config/>

<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
	<property name="locations" value="/WEB-INF/classes/jdbc.properties"/> 
</bean> 
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
	<property name="driverClass" value="${jdbc.driverClass}"/>
	<property name="jdbcUrl" value="${jdbc.jdbcUrl}"/>
	<property name="user" value="${jdbc.username}"/>
	<property name="password" value="${jdbc.password}"/>
	<property name="minPoolSize" value="5"/>
	<property name="maxPoolSize" value="50"/>
	<property name="maxIdleTime" value="1800"/>
	<property name="acquireIncrement" value="2"/>
	<property name="maxStatements" value="0"/>
	<property name="initialPoolSize" value="10"/>
	<property name="idleConnectionTestPeriod" value="30"/>
	<property name="acquireRetryAttempts" value="30"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="dataSource" ref="dataSource" />
	<property name="configLocations">
		<list>
			<value>classpath:hibernate.cfg.xml</value>
			<!-- 看这里 看这里 看这里 -->
                             <!-- 引入你的hibernate实体配置文件 -->
		</list>
	</property>
	<property name="mappingLocations">
		<list>
			<value>classpath:jbpm.execution.hbm.xml</value>
			<value>classpath:jbpm.history.hbm.xml</value>
			<!-- 使用自定义用户权限注释 此项-->
			<!--<value>classpath:jbpm.identity.hbm.xml</value>-->
			<value>classpath:jbpm.repository.hbm.xml</value>
			<value>classpath:jbpm.task.hbm.xml</value>
		</list>
	</property>
	<property name="hibernateProperties">
		<props>
			<prop key="hibernate.dialect">${jdbc.dialect}</prop>
			<prop key="hibernate.show_sql">true</prop>
			<prop key="hibernate.hbm2ddl.auto">update</prop>
		</props>
	</property>
</bean>
<!-- 配置事务管理器 -->

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


<!-- 配置事务的传播特性 -->

<tx:advice id="txAdvice" transaction-manager="transactionManager">
	<tx:attributes>
		<tx:method name="add*" propagation="REQUIRED" />
		<tx:method name="del*" propagation="REQUIRED" />
		<tx:method name="remove*" propagation="REQUIRED" />
		<tx:method name="update*" propagation="REQUIRED" />
		<tx:method name="modify*" propagation="REQUIRED" />
		<tx:method name="submit*" propagation="REQUIRED" />
		<tx:method name="insert*" propagation="REQUIRED" />
		<tx:method name="save*" propagation="REQUIRED" />
		<tx:method name="Update*" propagation="REQUIRED" />
		<tx:method name="Insert*" propagation="REQUIRED" />
	</tx:attributes>
</tx:advice>

<!-- 配置哪些类哪些方法使用事务 -->

<aop:config>
	<aop:pointcut id="allManagerMethod"
		expression="execution(* com.djzhou.gmms.service.*.impl.*.*(..))" />
	<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" />
</aop:config>

<!--jbpm4.4工作流  BEGIN-->  
 	<!-- jbpm集成 -->
  	<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" >
  		<property name="jbpmCfg" value="spring-jbpm4.cfg.xml" />
  	</bean>
  	<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />	
  	<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"/>  
   <!-- 
    <bean id="jbpmTemplate" class="com.chinanfs.jbpm.JbpmTemplate">
    	<property name="processEngine" ref="processEngine" />
    	<property name="executionService" ref="executionService" />
    	<property name="repositoryService" ref="repositoryService" />
    	<property name="taskService" ref="taskService" />
    	<property name="historyService" ref="historyService" />
    	<property name="identityService" ref="identityService" />
    </bean>
	 --> 
	<!--JBPM哪些类哪些方法使用事务 -->
	<aop:config>
		<aop:pointcut id="allManagerMethod2" expression="execution(* com.chinanfs.*.service.impl.*.*(..))" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod2" />
	</aop:config>
<!--JBPM END -->

</beans>

转载于:https://my.oschina.net/jeasyframe/blog/144441

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值