(spring2.x整合)applicationContext-dao.xml
来源:互联网 发布:qsv格式转换软件 编辑:程序博客网 时间:2024/05/21 05:37
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<!-- Spring2.x整合,代替hibernateSessionFactory -->
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml"/>
</bean>
<!-- 将IOC容器中的sessionFactory对象注入到HibernateDaoSupport abstract="true" 当模板,不能new-->
<bean id="hdo" class="org.springframework.orm.hibernate3.support.HibernateDaoSupport" abstract="true" >
<property name="sessionFactory" ref="mySessionFactory" />
</bean>
<bean id="bdo" class="ssh.lxl.util.SpringHibernateBaseDao" parent="hdo" />
<!-- dao -->
<bean id="udo" class="ssh.lxl.dao.impl.UserDaoImpl" parent="bdo"/>
<!-- 声明事务,给dao层create,update,delete统一添加事务-->
<bean id="myTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="mySessionFactory"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="myTxManager">
<tx:attributes>
<tx:method name="create*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="read*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="daoServiceMethods" expression="execution(* ssh.lxl.dao.impl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="daoServiceMethods"/>
</aop:config>
<!-- 通过后置通知实现运行时间记录 -->
<bean id="aBean" class="ssh.lxl.aop.RunningTimeBean" />
<!-- 用AOP实现数据访问层的日志管理 -->
<bean id="LogBean" class="ssh.lxl.aop.LogBean" />
<aop:config>
<!-- 通过前置通知运行时间记录 -->
<!-- -->
<aop:aspect id="beforeExample" ref="aBean">
<aop:pointcut id="b" expression="execution (* ssh.lxl.dao.impl.*.*(..))"/>
<aop:before
pointcut-ref="b"
method="doBeforeCheck"/>
</aop:aspect>
<!-- 通过后置通知运行时间记录 -->
<!-- -->
<aop:aspect id="afterReturningExample" ref="aBean">
<aop:pointcut id="dataAccessOperation"
expression="execution (* ssh.lxl.dao.impl.*.*(..))"/>
<aop:after-returning
pointcut-ref="dataAccessOperation"
method="doAccessCheck"/>
</aop:aspect>
<!-- 通过环绕通知运行时间记录 -->
<aop:aspect id="aroundExample" ref="LogBean">
<aop:pointcut id="logPoint"
expression="execution (* ssh.lxl.dao.impl.*.*(..))"/>
<aop:around
pointcut-ref="logPoint"
method="doBasicProfiling"/>
</aop:aspect>
</aop:config>
</beans>
- (spring2.x整合)applicationContext-dao.xml
- applicationContext-dao.xml
- applicationContext-dao.xml
- applicationContext-dao.xml的配置
- Spring2.5.6中applicationContext.xml配置
- Spring2 ApplicationContext
- applicationContext.xml整合hibernate mybatis
- Spring与Hibernate整合(applicationContext.xml写法)
- javaWeb服务详解(含源代码,测试通过,注释) ——applicationContext-dao.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- spring整合mybatis的applicationContext.xml配置文件
- SSM整合之applicationContext.XML配置文件详解
- spring、mybatis整合核心配置文件applicationContext.xml
- SSM整合之applicationContext.XML配置文件详解
- SSH整合applicationContext.xml配置文件(my project)
- spring、hibernate整合核心配置文件applicationContext.xml
- ssh 整合之 struts1.x 和 spring2.5的整合
- 算法
- 十九 设计模式之访问者模式
- 二十 设计模式之状态模式
- Windows XP 上 KB977377导致证书不可用问题
- Fedora如何删除旧内核?
- (spring2.x整合)applicationContext-dao.xml
- CUDA实现平衡树求前缀和
- 二十一 设计模式之解释器模式
- Android字符串资源及其格式化
- 二十二 设计模式之享元模式
- 堪称一绝的“IO口扫键”法
- AutoCAD .NET API基础(一) AutoCAD 对象层次结构(3)
- 【转】19 个漂亮的 jQuery 画廊和幻灯片插件
- 二十三 设计模式之桥梁模式