重学SpringBoot. step2 Spring AOP
2024-09-08 18:55:21
Spring AOP
AOP的原理,就是生成对象的代理,然后通过在代理的执行中,添加一些钩子来扩展功能。
@Aspect
public class MyAspect {
@Pointcut("execution(* cn.kbug.code.service.impl.*.*(..))")
public void pointCut(){
}
@Around("pointCut()")
public void around(ProceedingJoinPoint pjp) throws Throwable {
pjp.proceed();
System.out.println("around");
}
@Before("pointCut()")
public void before(){
System.out.println("before .. ");
}
@After("pointCut()")
public void after(){
System.out.println(" after ..");
}
@AfterReturning("pointCut()")
public void afterReturning(){
System.out.println(" after returning ..");
}
@AfterThrowing("pointCut()")
public void afterThrowing(){
System.out.println(" afterThrowing ..");
}
}
最新文章
- Android 开源项目及其学习
- jqgrid学习笔记(转载)
- 研二下学期做的第一个项目(主要关于datagridview的一些笔记)
- 2015 Android Dev Summit(安卓开发峰会)第一天
- function [ binary,decimal ] = num2binary16( number )
- jQuery.outerWidth() 函数详解
- QTableWidget嵌入QpushButton后定位是哪一个QpushButton
- SAP 物料基本单位与BOM单位
- vi使用教程
- webclient下载文件 带进度条
- Android文本Flood it游戏源代码
- 前段验证框架 formValidator
- 检查Json格式工具
- LeetCode算法题-Intersection of Two Arrays(Java实现-四种解法)
- 延期版本webstorm(解决许可证过期,注册,激活,破解,码,支持正版,最新可用)
- 一行css解决图片统一大小后的拉伸问题(被冷漠的object-fit)
- Gym 100096D Guessing game
- 禁止选择DIV内的文本(css,js写法)
- [转载]DB2与ORACLE、MYSQL比较2
- Unable to resolve target 'android-9'