spring声明式事务配置方法(六):aop:config切入
来源:互联网 发布:联通多号通软件 编辑:程序博客网 时间:2024/05/21 10:58
- <?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.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
- <bean id="testAction" class="test.action.Stuts2ActionTest">
- <property name="service" ref="templatesService"></property>
- </bean>
- <bean id="templatesService"
- class="test.service.impl.TaoTemplatesServiceImpl">
- <property name="dao" ref="templatesDAO" />
- </bean>
- <bean id="templatesDAO" class="test.dao.impl.TaoTemplatesDAOImpl">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <!--定义数据源-->
- <bean id="dataSource"
- class="org.apache.commons.dbcp.BasicDataSource">
- <!-- 定义数据库驱动-->
- <property name="driverClassName">
- <value>oracle.jdbc.driver.OracleDriver</value>
- </property>
- <!-- 定义数据库url-->
- <property name="url">
- <value>jdbc:oracle:thin:@192.168.1.96:1521:yxdb</value>
- </property>
- <!-- 定义数据库用户名-->
- <property name="username">
- <value>yxuser</value>
- </property>
- <!-- 定义数据库密码-->
- <property name="password">
- <value>yxuser</value>
- </property>
- </bean>
- <!--定义一个hibernate的SessionFactory-->
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <!-- 定义SessionFactory必须注入DataSource-->
- <property name="dataSource">
- <ref local="dataSource" />
- </property>
- <property name="mappingResources">
- <list>
- <!--以下用来列出所有的PO映射文件-->
- <value>test/mapping/Tao_Templates.hbm.xml</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">
- org.hibernate.dialect.Oracle10gDialect
- </prop>
- <prop key="hibernate.show_sql">true</prop>
- <!--此处用来定义hibernate的SessionFactory的属性:
- 不同数据库连接,启动时选择create,update,create-drop -->
- <prop key="hibernate.hbm2ddl.auto">update</prop>
- </props>
- </property>
- </bean>
- <bean id="transactionManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory">
- <ref bean="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="mod*" propagation="REQUIRED" />
- <tx:method name="*" read-only="true" />
- </tx:attributes>
- </tx:advice>
- <!-- Spring AOP config -->
- <aop:config >
- <!-- 切入点 -->
- <aop:pointcut id="newServicesPointcut"
- expression="execution(* test.dao.impl.*.*(..))" />
- <aop:pointcut id="newServicesPointcut2"
- expression="execution(* com.yx.news.model.*.*(..))" />
- <aop:advisor advice-ref="txAdvice"
- pointcut-ref="newServicesPointcut" />
- <aop:advisor advice-ref="txAdvice"
- pointcut-ref="newServicesPointcut2" />
- </aop:config>
- </beans>
- spring声明式事务配置方法(六):aop:config切入
- spring声明式事务配置方法 aop:config切入
- Spring 配置 ——事务:aop:config切入
- Spring 配置 ——事务:aop:config切入
- Spring 配置 ——事务:aop:config切入
- Spring事务管理-aop切入配置
- spring声明式事务(六)
- 在Spring中采用声明式方法对Hibernate和JDBC进行统一的事务配置(AOP)
- 使用Spring AOP 自动代理配置声明式事务
- 使用Spring AOP 自动代理配置声明式事务
- Spring基于tx/aop声明式事务配置
- Spring声明式事务配置——AOP方式
- Spring基于tx/aop声明式事务配置
- spring.net tx:advice 和 aop:config 配置事务 匹配名字的方法管理事务
- Spring 声明式事务的配置方式(六)
- Spring声明式事务(AOP的tx方式)
- Spring Aop实现声明式事务
- spring声明式事务【使用AOP】
- D-Bus学习(十一):在D-Bus上的telepathy[二]:进一步了解
- GoogleCode的SVN空间使用初步
- Perl实现的Expect的telnet应用
- ORA-00600: 内部错误代码, 参数: [32695], [hash aggregation can't be done]
- Flex分享: ResouceManager应用于本地化与国际化开发
- spring声明式事务配置方法(六):aop:config切入
- java extjs 链接数据库返回json
- 索引压缩问题
- 修改s3c440普通串口驱动为485驱动
- MYSQL中EXPLAIN的说明
- QQ的在线拼音输入法
- 普通行列转换(交叉表,横表变列表)
- mysql连接测试程序
- 关于位运算的应用