spring aop

代理增强

spring-aop

切入点
连接点
通知
切面
表达式


表达式

public void com.atguigu.service.HelloService.test(int,)

访问修饰符省略
void *
com.atguigu.service
*…
HelloService *
test *.
(int) *

全通配表达式

  • .()

配置方式

纯注解配置
@EnableAspectJAutoProxy


注解配置
aop:aspectj-autoproxy开启基于注解aop配置

@component
@aspect
通知类

@pointcut(“excution”)
public void pointcut(){}

@before(“pointcut”)
@afterreturning
@afterthrowing
@after
@around
public object around (pointcut point)
{
try{
//前置
poing.proceed();
//后置
}
catch(Throwable e){
//异常
throw new runtimeException();
}
finally{
//最终
}
}


XML配置

aop:config
<aop:pointcut id = “” pointcut = “excution(* .*(…))”>
aop:aspect
<aop:before method = “” pointcut-ref = “”>
aop:after-returning
aop:after-throwing
aop:after
aop:around
aop:aspect
aop:config


基于spring-tx 配置事务
spring-jdbc
spring-tx

jdbc.datasource

事务管理器
抽象接口
PlatformTransactionManager
实现类
DataSourceTransactionManager

spring 自带数据源连接池
driverManagerDataSource

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值