基於jeasyframe框架進行開發項目實例

實例下載地址:http://git.oschina.net/jeasyframe/jeasyframegit

實例中主要是底層代碼的實例,對於action和jsp頁面,能夠直接仿照jeasyframe框架中的代碼進行開發.相信有了這個實例以後,你會很快上手的.spring

嘮叨一句,擴展開發的話,別忘了把hibernate實體映射文件放到applicationContext-common.xml中. struts配置文件,別忘了引入你本身的struts分支哦.sql

好啦,有不懂的繼續留言給我吧,我會及時回覆的.express

<!-- 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>session

相關文章
相關標籤/搜索