Spring 声明式事务的配置方式(六)
来源:互联网 发布:360不能卸载软件 编辑:程序博客网 时间:2024/05/29 02:45
这种方式是基于注解的配置方式
<!-- 开启注解和扫描指定包下面的注解类 --> <context:component-scan base-package="org.companyname.myprj"/> <!-- HibernateTemplate模板 --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 非注解事务的配置--> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <aop:config> <aop:pointcut expression="execution(* org.companyname.myprj.services..*.*(..))" id="transactionPointcut" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <!—基于注解的配置就不在Spring的配置文件中配置业务模块--> 持久类 @Repository(“daoTemplate”) public class DaoTemplate impletements IdaoTemplate{ @Resource(name=”hibernateTemplate”) private HibernateTemplate hibernateTemplate=null; //codes here.. } 业务类 @Service(“UsersBiz”) public class UsersService implements IusersService{ @Resource(name=”daoTemplate”) private IdaoTemplate daoTemplate=null; //codes here.. }
- Spring 声明式事务的配置方式(六)
- Spring声明式事务的配置方式
- spring配置声明式事务--注解方式
- Spring配置声明式事务--注解方式
- Spring 声明式事务的配置方式(一)
- Spring 声明式事务的配置方式(二)
- Spring 声明式事务的配置方式(三)
- Spring 声明式事务的配置方式(四)
- Spring 声明式事务的配置方式(五)
- Spring 的声明式事务配置
- Spring配置声明式事务--xml配置文件方式
- Spring声明式事务配置——AOP方式
- spring 配置声明式事务
- spring声明式事务配置
- spring声明式事务配置
- spring声明式事务配置
- spring声明式事务配置
- spring声明式事务配置
- d16 format on nv card
- DataGridView中添加CheckBox控件主要采用两种方法
- 在 Lotus Domino 8 上利用 OSGi 特性开发和部署插件程序
- c++编写xml操作类(完整版)
- 设置Exchange2007首次登录默认语言
- Spring 声明式事务的配置方式(六)
- 九、HttpServlet类 HttpServeltRequest类 HttpServletResponse类 HttpServletContext类
- Some functions about time
- JDBC连接MYSQL数据库
- 分割存储过程
- centos 搭建 svn 服务
- 静态数据成员
- 获得网站的Cookies信息
- SD卡的接口