当前位置: 首页 > news >正文

虚拟主机是指什么seo怎么学在哪里学

虚拟主机是指什么,seo怎么学在哪里学,烟台网站建设科技,西安便宜做网站Aspect(切面):用于标识一个类是切面的注解。通常与其他通知注解一起使用,定义切面类。 Pointcut(切点): 注解来定义切点,它用于描述哪些连接点将会被通知所通知。 连接点&#xff…

@Aspect(切面):用于标识一个类是切面的注解。通常与其他通知注解一起使用,定义切面类。

@Pointcut(切点): 注解来定义切点,它用于描述哪些连接点将会被通知所通知。

连接点:execution(* com.example.service.*.*(..))

通知类

  1. @Before:前置通知,在目标方法执行前执行。
  2. @Around:环绕通知,在目标方法执行前后都执行,并且可以控制是否执行目标方法。
  3. @AfterReturning:正常返回通知,目标方法正常返回后执行。
  4. @AfterThrowing:异常返回通知,在目标方法抛出异常后执行。
  5. @After:后置通知,在目标方法执行后执行,无论是否抛出异常都会执行。

执行顺序:

1、使用前置通知

  • 正常返回情况:@Before -> 方法 -> @AfterReturning -> @After
  • 异常返回情况:@Before -> 方法 -> @AfterThrowing -> @After

2、使用环绕通知

  • 正常返回情况:@Around(前)-> 方法 -> @Around(后) -> @AfterReturning -> @After
  • 异常返回情况:@Around(前)-> 方法 -> @Around(后) -> @AfterThrowing -> @After

3、前置通知和环绕通知都使用

  • 正常返回情况:@Before -> @Around(前)-> 方法 -> @Around(后)-> @AfterReturning -> @After
  • 异常返回情况:@Before -> @Around(前)-> 方法 -> @Around(后) -> @AfterThrowing -> @After

注意:在 @Around 通知类型中,通过调用 ProceedingJoinPoint.proceed() 才会触发目标方法的执行,因此可以在方法执行前后加入额外的逻辑。

实现AOP案例:

@Aspect
@Component
public class LoggingAspect {@Before("execution(* com.example.MyService.*(..))")public void beforeMethodExecution(JoinPoint joinPoint) {String methodName = joinPoint.getSignature().getName();System.out.println("Before executing method: " + methodName);}@Around("execution(* com.example.MyService.*(..))")public Object aroundMethodExecution(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {String methodName = proceedingJoinPoint.getSignature().getName();System.out.println("Before executing method: " + methodName);// 执行目标方法Object result = proceedingJoinPoint.proceed();System.out.println("After executing method: " + methodName + ", result is " + result);return result;}@AfterReturning(pointcut = "execution(* com.example.MyService.*(..))", returning = "result")public void afterMethodExecution(Object result) {System.out.println("After method execution, the result is " + result);}@AfterThrowing(pointcut = "execution(* com.example.MyService.*(..))", throwing = "e")public void afterMethodThrowing(JoinPoint joinPoint, Exception e) {String methodName = joinPoint.getSignature().getName();System.out.println("Method " + methodName + " threw exception: " + e.getMessage());}@After("execution(* com.example.MyService.*(..))")public void afterMethodExecution(JoinPoint joinPoint) {String methodName = joinPoint.getSignature().getName();System.out.println("After executing method: " + methodName);}
}

ps:以下是我整理的java面试资料,密码是obht,感兴趣的可以看看。最后,创作不易,觉得写得不错的可以点点关注!

链接:https://www.yuque.com/u39298356/uu4hxh?# 《Java面试宝典》 

http://www.hkea.cn/news/892483/

相关文章:

  • php 手机网站 上传图片定制网站建设
  • 关于网站建设的问题百度关键词分析
  • 登录官方网站装修公司网络推广方案
  • 设计网站官网入口网站搜索优化方法
  • 网站优化qq群山东做网站
  • wordpress icomoon太原seo快速排名
  • 中华建设杂志网站记者数据指数
  • 网站开发测试情况南召seo快速排名价格
  • 上海仓储公司小红书seo优化
  • 南京建设公司网站网络营销整合推广
  • wordpress更改语言沈阳seo优化
  • wordpress免费网站世界大学排名
  • 做网站的属于什么专业?百度爱采购竞价推广
  • 网站建设一年多少恰东莞网站到首页排名
  • 新企业网站应该怎么做SEO优化广告联盟有哪些
  • 手机app开发网站建设软文推广文章案例
  • 网站自然排名百度经验官网登录
  • dz网站模板沧州网站优化公司
  • 桂林论坛天涯社区培训行业seo整站优化
  • 做伊瑞尔竞技场的网站搜索引擎简称seo
  • 46云虚拟主机股票发行ipo和seo是什么意思
  • 新泰做网站菏泽seo
  • 网站建设排名东莞seo收费
  • 做网站前后端的发布流程自己如何制作网站
  • 网站营销与推广策略百度一下官网首页百度
  • 网站建设张世勇100个免费推广b站
  • 网络营销的常用工具百度关键词优化点击 教程
  • 公司网站要怎么做少儿编程培训机构排名前十
  • 一个好的网站是什么样的商家联盟营销方案
  • 网站解除域名绑定网站广告收费标准