Spring
nickta
做一个平凡而不平淡的人
展开
-
Spring Aop剖析【透过代码看AOP本质】
spring.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/sc原创 2020-09-14 21:34:14 · 106 阅读 · 0 评论 -
Spring手动管理事务提交、回滚
配置好Spring事务之后(Spring事务配置,可参见其它文件),我们可以简单的添加一个注释@Transactional实现事务, 但是如果方法中Catch了异常,此异常没有抛出,那么事务将不会生效。 可以在Catch中加入如下代码实现事务回滚功能: @Transactional(rollbackFor = Exception.class) public Result test() { try { // biz } catch(Exception e) { ..原创 2020-09-14 19:27:41 · 1008 阅读 · 0 评论