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

上海做家庭影院的公司网站seo怎么做教程

上海做家庭影院的公司网站,seo怎么做教程,成都网站制作工作室,网页升级紧急通知拿笔记好文章目录 一、Spring Boot AOP简介二、通知顺序1. 通知类型及其顺序示例代码 2. 控制通知顺序示例代码 一、Spring Boot AOP简介 AOP(Aspect-Oriented Programming,面向切面编程)是对OOP(Object-Oriented Programming&#xff0c…

文章目录

  • 一、Spring Boot AOP简介
  • 二、通知顺序
    • 1. 通知类型及其顺序
      • 示例代码
    • 2. 控制通知顺序
      • 示例代码


一、Spring Boot AOP简介

AOP(Aspect-Oriented Programming,面向切面编程)是对OOP(Object-Oriented Programming,面向对象编程)的补充。AOP通过预编译方式和运行期动态代理实现在不修改源代码的情况下给程序动态统一添加功能的一种技术。

在Spring Boot中,AOP主要通过注解和AspectJ来实现。主要的AOP注解有:

  • @Aspect:定义切面类
  • @Before:前置通知
  • @After:后置通知
  • @AfterReturning:返回通知
  • @AfterThrowing:异常通知
  • @Around:环绕通知

二、通知顺序

1. 通知类型及其顺序

在Spring AOP中,通知按以下顺序执行:

  1. @Around(环绕通知)前半部分
  2. @Before(前置通知)
  3. 被代理的方法执行
  4. @AfterReturning(返回通知)或@AfterThrowing(异常通知)
  5. @After(后置通知)
  6. @Around(环绕通知)后半部分

示例代码

@Aspect
@Component
public class LoggingAspect {@Before("execution(* com.example.service.*.*(..))")public void logBefore(JoinPoint joinPoint) {System.out.println("logBefore() is running!");}@After("execution(* com.example.service.*.*(..))")public void logAfter(JoinPoint joinPoint) {System.out.println("logAfter() is running!");}@AfterReturning(pointcut = "execution(* com.example.service.*.*(..))", returning = "result")public void logAfterReturning(JoinPoint joinPoint, Object result) {System.out.println("logAfterReturning() is running!");}@AfterThrowing(pointcut = "execution(* com.example.service.*.*(..))", throwing = "error")public void logAfterThrowing(JoinPoint joinPoint, Throwable error) {System.out.println("logAfterThrowing() is running!");}@Around("execution(* com.example.service.*.*(..))")public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {System.out.println("logAround() before is running!");Object result = joinPoint.proceed();System.out.println("logAround() after is running!");return result;}
}

2. 控制通知顺序

在不同的切面之间定义通知的执行顺序。可以使用@Order注解。

示例代码

@Aspect
@Order(1)
@Component
public class FirstAspect {@Before("execution(* com.example.service.*.*(..))")public void beforeAdvice() {System.out.println("FirstAspect beforeAdvice()");}
}@Aspect
@Order(2)
@Component
public class SecondAspect {@Before("execution(* com.example.service.*.*(..))")public void beforeAdvice() {System.out.println("SecondAspect beforeAdvice()");}
}

FirstAspectbeforeAdvice会先于SecondAspectbeforeAdvice执行。

http://www.yidumall.com/news/104011.html

相关文章:

  • 做个公司网站一般多少钱推广app的单子都在哪里接的
  • 网站建设必要性看片应该搜什么关键词哪些词
  • 如何做复制别人的网站模版seo入门书籍
  • 太原优化网站福州百度代理
  • 做网站需要用到ps吗全网推广平台
  • 做网站讯息旅游网站网页设计
  • 备案 网站备注无线新闻台直播app下载
  • 制作表情包的软件appgoogleseo服务公司
  • 静态网站什么样申请自己的网站
  • wordpress免登录付费阅读seo搜外
  • 网站侧边栏设计seo专业培训课程
  • 建微网站需要购买官网主机吗十大网站平台
  • 一直免费的服务器下载seo黑帽有哪些技术
  • IP不能安装wordpress考拉seo
  • 商丘做手机做网站网络营销的主要内容有哪些
  • 无锡哪里有建设网站谷歌 google
  • 网站排名易下拉效率佛山网站营销推广
  • 泰安可以做网站的公司云seo
  • 建筑设计公司注册seo站内优化包括
  • 国内网络科技网站建设北京seo顾问服务
  • 为公司做网站可以发广告的平台
  • 学院网站建设个人发布信息的免费平台
  • 借款网站模板谁有恶意点击软件
  • 网站建设报价单ppt百度推广系统营销平台
  • 漳浦县网站建设百度前三推广
  • 互联网怎么推广产品seo优化的方法有哪些
  • 哪些网站可以做外部锚文本重庆网站建设
  • 西安有什么网站搜索优化是什么意思
  • 设计的网站有哪些seo与sem的区别
  • Wordpress在中国建站建立网站的基本流程