自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(7)
  • 收藏
  • 关注

原创 before

Before(value = “pointdemo()”) public void beafor(){ System.out.println(“before…”); //最终通知 @After(value = “execution(* com.Keafmd.spring5.aopanno.User.add(…))”) public void after(){ System.out.println(“after…”); //后置通知(返回通知) @AfterReturning(value = “executi

2021-01-20 23:35:06 39

原创 name

@ClassName: UserPtoxy @Description: 增强类 @author: 牛哄哄的柯南 @date: 2021-01-18 13:56 */ @Component @Aspect //生成代理对象 @Order(3) public class UserProxy {

2021-01-20 23:34:22 39

原创 use

在增强类的里面,在作为通知方法上面添加通知类型注解,使用切入点表达式配置。 UserProxy 类: package com.Keafmd.spring5.aopanno; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.core.annotation.Order; import org.springframework.stereotyp

2021-01-20 23:33:45 42

原创 org

import org.springframework.stereotype.Component; /** Keafmd @ClassName: User @Description: 基于注解 被增强的类 @author: 牛哄哄的柯南 @date: 2021-01-18 13:54 */ @Component public class User { public void add(){ // int i = 10/0; System.out.println(“add…”

2021-01-20 23:15:03 46

原创 2021-01-20

例 1:对 com.atguigu.dao.BookDao 类里面的 add 进行增强 execution( * com.atguigu.dao.BookDao.add(…)) 例 2:对 com.atguigu.dao.BookDao 类里面的所有的方法进行增强 execution( * com.atguigu.dao.BookDao. * (…)) 例 3:对 com.atguigu.dao 包里面所有类,类 ...

2021-01-20 23:14:06 59

原创 xml

Spring 框架一般都是基于 AspectJ 实现 AOP 操作。 需要注意的是:AspectJ 不是 Spring 组成部分,独立 AOP 框架,一般把 AspectJ 和 Spirng 框架一起使用,进行 AOP 操作。 基于 AspectJ 实现 AOP 操作有两种方式: (1)基于 xml 配置文件实现 (2)基于注解方式实现(普遍使用) ...

2021-01-20 23:13:19 39

原创 aop

在项目工程里面引入 AOP 相关依赖。 学会使用切入点表达式 AOP 操作(AspectJ 注解) 1、创建类,在类里面定义方法 2、创建增强类(编写增强逻辑),在增强类里面,创建方法,让不同方法代表不同通知类型 3、进行通知的配置 4、配置不同类型的通知 相同的切入点抽取 有多个增强类多同一个方法进行增强,设置增强类优先级 完全使用注解开发 代码结构 测试代码 ...

2021-01-20 23:12:32 34

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除