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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
default-autowire="byName" default-lazy-init="true">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.db</value>
</property>
</bean>
<!--
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://xxxxxxxxxx:3306/imrms">
</property>
<property name="username" value="user"></property>
<property name="password" value="User"></property>
</bean>
-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>
com/midland/eagents/vo/ImrmsSalesResume.hbm.xml
</value>
<value>com/midland/eagents/vo/ImrmsData.hbm.xml</value>
<value>
com/midland/eagents/vo/ImrmsNetPersonDateHitStat.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsCommiData.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsBusinessData.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsNetFloorDateHitsStat.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsDiaryHit.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsPic2estid.hbm.xml
</value>
<value>
com/midland/eagents/vo/TbBrmRegion.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsBusinessDataImgs.hbm.xml
</value></list>
</property></bean>
<!-- 配置事务 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!-- 此处设置spring 管理session 如果不设会出现session没关的问题 -->
<!--
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="set*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="remove">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>imrmsCommiDataDaoImp</value>
<value>imrmsSalesResumeDaoImp</value>
<value>imrmsBusinessDataDaoImp</value>
<value>imrmsNetFloorDateHitsStatDaoImp</value>
<value>imrmsDiaryHitDaoImp</value>
<value>imrmsDataDaoImp</value>
<value>imrmsTbBrmRegionDaoImp</value>
<value>eagentManagerImpl</value>
<value>officeManager</value>
<value>shopManager</value>
<value>homeManager</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
<property name="transactionInterceptor" ref="transactionInterceptor"/>
</bean>
-->
<!--
其中带问号的modifiers-pattern?(public/protected) 和 declaring-type-pattern? throws-pattern? 可以不填
可见execution(* *..BookManager.save(..))
第一颗* 代表ret-type-pattern 返回值可任意,
*..BookManager 代表任意Pacakge里的BookManager类。
如果写成com.xyz.service.* 则代表com.xyz.service下的任意类
com.xyz.service..* com.xyz.service则代表com.xyz.service及其子package下的任意类
save代表save方法,也可以写save* 代表saveBook()等方法
(..) 匹配0个参数或者多个参数的,任意类型
(x,..) 第一个参数的类型必须是X
(x,,,s,..) 匹配至少4个参数,第一个参数必须是x类型,第二个和第三个参数可以任意,第四个必须是s类型。
-->
<!-- 支持 @Transactional 标记 -->
<tx:annotation-driven/>
<!-- 支持 @AspectJ 标记-->
<aop:aspectj-autoproxy/>
<!-- 以AspectJ方式 定义 AOP -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.midland.eagents.service.*Manager*.*(..))"
advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.midland.eagents.dao.imp.*Dao*.*(..))"
advice-ref="txAdvice"/>
</aop:config>
<!-- 基本事务定义,使用transactionManager作事务管理,默认get*方法的事务为readonly,其余方法按默认设置.
默认的设置请参考Spring文档事务一章. -->
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<bean id="imrmsSalesResumeDaoImp" class="com.midland.eagents.dao.imp.ImrmsSalesResumeDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsCommiDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsCommiDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsBusinessDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsBusinessDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsNetFloorDateHitsStatDaoImp" class="com.midland.eagents.dao.imp.ImrmsNetFloorDateHitsStatDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsDiaryHitDaoImp" class="com.midland.eagents.dao.imp.ImrmsDiaryHitDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsTbBrmRegionDaoImp" class="com.midland.eagents.dao.imp.ImrmsTbBrmRegionDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 首页参数配置开始 -->
<bean name="/index" class="com.midland.eagents.struts.action.IndexAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsDataDao">
<ref local="imrmsDataDaoImp"/>
</property>
<property name="imrmsCommiDataDao">
<ref local="imrmsCommiDataDaoImp"/>
</property>
<property name="imrmsBusinessDataDao">
<ref local="imrmsBusinessDataDaoImp"/>
</property>
<property name="imrmsNetFloorDateHitsStatDao">
<ref local="imrmsNetFloorDateHitsStatDaoImp"/>
</property>
<property name="imrmsDiaryHitDao">
<ref local="imrmsDiaryHitDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
<!-- 首页配置结束 -->
<!-- profile页面参数配置开始 -->
<bean name="/profile" class="com.midland.eagents.struts.action.ProfileAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsDataDao">
<ref local="imrmsDataDaoImp"/>
</property>
<property name="imrmsCommiDataDao">
<ref local="imrmsCommiDataDaoImp"/>
</property>
<property name="imrmsBusinessDataDao">
<ref local="imrmsBusinessDataDaoImp"/>
</property>
<property name="imrmsNetFloorDateHitsStatDao">
<ref local="imrmsNetFloorDateHitsStatDaoImp"/>
</property>
<property name="imrmsDiaryHitDao">
<ref local="imrmsDiaryHitDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
<!-- profile页面配置结束 -->
<bean name="/eagent" class="com.midland.eagents.struts.action.EagentAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
</beans>
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
default-autowire="byName" default-lazy-init="true">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.db</value>
</property>
</bean>
<!--
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://xxxxxxxxxx:3306/imrms">
</property>
<property name="username" value="user"></property>
<property name="password" value="User"></property>
</bean>
-->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>
com/midland/eagents/vo/ImrmsSalesResume.hbm.xml
</value>
<value>com/midland/eagents/vo/ImrmsData.hbm.xml</value>
<value>
com/midland/eagents/vo/ImrmsNetPersonDateHitStat.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsCommiData.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsBusinessData.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsNetFloorDateHitsStat.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsDiaryHit.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsPic2estid.hbm.xml
</value>
<value>
com/midland/eagents/vo/TbBrmRegion.hbm.xml
</value>
<value>
com/midland/eagents/vo/ImrmsBusinessDataImgs.hbm.xml
</value></list>
</property></bean>
<!-- 配置事务 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!-- 此处设置spring 管理session 如果不设会出现session没关的问题 -->
<!--
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="set*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="remove">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>imrmsCommiDataDaoImp</value>
<value>imrmsSalesResumeDaoImp</value>
<value>imrmsBusinessDataDaoImp</value>
<value>imrmsNetFloorDateHitsStatDaoImp</value>
<value>imrmsDiaryHitDaoImp</value>
<value>imrmsDataDaoImp</value>
<value>imrmsTbBrmRegionDaoImp</value>
<value>eagentManagerImpl</value>
<value>officeManager</value>
<value>shopManager</value>
<value>homeManager</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
<property name="transactionInterceptor" ref="transactionInterceptor"/>
</bean>
-->
<!--
其中带问号的modifiers-pattern?(public/protected) 和 declaring-type-pattern? throws-pattern? 可以不填
可见execution(* *..BookManager.save(..))
第一颗* 代表ret-type-pattern 返回值可任意,
*..BookManager 代表任意Pacakge里的BookManager类。
如果写成com.xyz.service.* 则代表com.xyz.service下的任意类
com.xyz.service..* com.xyz.service则代表com.xyz.service及其子package下的任意类
save代表save方法,也可以写save* 代表saveBook()等方法
(..) 匹配0个参数或者多个参数的,任意类型
(x,..) 第一个参数的类型必须是X
(x,,,s,..) 匹配至少4个参数,第一个参数必须是x类型,第二个和第三个参数可以任意,第四个必须是s类型。
-->
<!-- 支持 @Transactional 标记 -->
<tx:annotation-driven/>
<!-- 支持 @AspectJ 标记-->
<aop:aspectj-autoproxy/>
<!-- 以AspectJ方式 定义 AOP -->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.midland.eagents.service.*Manager*.*(..))"
advice-ref="txAdvice"/>
<aop:advisor pointcut="execution(* com.midland.eagents.dao.imp.*Dao*.*(..))"
advice-ref="txAdvice"/>
</aop:config>
<!-- 基本事务定义,使用transactionManager作事务管理,默认get*方法的事务为readonly,其余方法按默认设置.
默认的设置请参考Spring文档事务一章. -->
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<bean id="imrmsSalesResumeDaoImp" class="com.midland.eagents.dao.imp.ImrmsSalesResumeDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsCommiDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsCommiDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsBusinessDataDaoImp" class="com.midland.eagents.dao.imp.ImrmsBusinessDataDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsNetFloorDateHitsStatDaoImp" class="com.midland.eagents.dao.imp.ImrmsNetFloorDateHitsStatDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsDiaryHitDaoImp" class="com.midland.eagents.dao.imp.ImrmsDiaryHitDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="imrmsTbBrmRegionDaoImp" class="com.midland.eagents.dao.imp.ImrmsTbBrmRegionDaoImp" >
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 首页参数配置开始 -->
<bean name="/index" class="com.midland.eagents.struts.action.IndexAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsDataDao">
<ref local="imrmsDataDaoImp"/>
</property>
<property name="imrmsCommiDataDao">
<ref local="imrmsCommiDataDaoImp"/>
</property>
<property name="imrmsBusinessDataDao">
<ref local="imrmsBusinessDataDaoImp"/>
</property>
<property name="imrmsNetFloorDateHitsStatDao">
<ref local="imrmsNetFloorDateHitsStatDaoImp"/>
</property>
<property name="imrmsDiaryHitDao">
<ref local="imrmsDiaryHitDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
<!-- 首页配置结束 -->
<!-- profile页面参数配置开始 -->
<bean name="/profile" class="com.midland.eagents.struts.action.ProfileAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsDataDao">
<ref local="imrmsDataDaoImp"/>
</property>
<property name="imrmsCommiDataDao">
<ref local="imrmsCommiDataDaoImp"/>
</property>
<property name="imrmsBusinessDataDao">
<ref local="imrmsBusinessDataDaoImp"/>
</property>
<property name="imrmsNetFloorDateHitsStatDao">
<ref local="imrmsNetFloorDateHitsStatDaoImp"/>
</property>
<property name="imrmsDiaryHitDao">
<ref local="imrmsDiaryHitDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
<!-- profile页面配置结束 -->
<bean name="/eagent" class="com.midland.eagents.struts.action.EagentAction" >
<property name="imrmsSalesResumeDao">
<ref local="imrmsSalesResumeDaoImp"/>
</property>
<property name="imrmsTbBrmRegionDao">
<ref local="imrmsTbBrmRegionDaoImp"/>
</property>
</bean>
</beans>