@Component
@Scope("prototype")
@Aspect(value="perthis(execution(* com.helius.service.impl.*.*(..)))")
//表明当前类是一个切面类
public class LogUtil { /**
* 用于配置当前方法是一个前置通知
*/
@Before("execution(* com.helius.service.impl.*.saveUser(..))")
public void printLog(){
System.out.println("执行打印日志的功能");
}
}

默认情况下我们的切面类是单例的,当我们指定@Scope("prototype")为多例时,切面类为多例。

在Spring AOP中,切面类的实例只有一个,比如前面我们一直使用的MyAspect类,假设我们使用的切面类需要具有某种状态,以适用某些特殊情况的使用,比如多线程环境,此时单例的切面类就不符合我们的要求了

语法为

perthis(pointcut-expression)

这种切面 类的用法实际业务没遇到过,只做了解。

@AspectJ注解的value属性的更多相关文章

  1. Spring学习之旅(八)Spring 基于AspectJ注解配置的AOP编程工作原理初探

    由小编的上篇博文可以一窥基于AspectJ注解配置的AOP编程实现. 本文一下未贴出的相关代码示例请关注小编的上篇博文<Spring学习之旅(七)基于XML配置与基于AspectJ注解配置的AO ...

  2. spring AOP 之二:@AspectJ注解的3种配置

    @AspectJ相关文章 <spring AOP 之二:@AspectJ注解的3种配置> <spring AOP 之三:使用@AspectJ定义切入点> <spring ...

  3. Spring学习(十八)----- Spring AOP+AspectJ注解实例

    我们将向你展示如何将AspectJ注解集成到Spring AOP框架.在这个Spring AOP+ AspectJ 示例中,让您轻松实现拦截方法. 常见AspectJ的注解: @Before – 方法 ...

  4. Spring Aop(四)——基于Aspectj注解的Advice介绍

    转发地址:https://www.iteye.com/blog/elim-2395315 4 基于Aspectj注解的Advice介绍 之前介绍过,Advice一共有五种类型,分别是before.af ...

  5. Spring Aop(二)——基于Aspectj注解的Spring Aop简单实现

    转发地址:https://www.iteye.com/blog/elim-2394762 2 基于Aspectj注解的Spring Aop简单实现 Spring Aop是基于Aop框架Aspectj实 ...

  6. 基于@AspectJ注解配置切面与基于XML配置切面

    1. Waiter目标类 package com.smart.aop.advice.pointcut; public class Waiter { public void greetTo(String ...

  7. Spring5参考指南:AspectJ注解

    文章目录 什么是AspectJ注解 启用AOP 定义Aspect 定义Pointcut 切入点指示符(PCD) 切入点组合 Advice 访问JoinPoint Advice参数 Advice参数和泛 ...

  8. Spring——AOP(面向切面编程)@AspectJ注解方式

    一.什么是AOP? AOP: (Aspect Oriented Programming)即面向切面编程. 试想这样的场景:项目中需要在业务方法执行完打印日志记录.最笨的办法就是在每个方法核心业务执行完 ...

  9. SpringMVC的数据格式化-注解驱动的属性格式化

    一.什么是注解驱动的属性格式化? --在bean的属性中设置,SpringMVC处理 方法参数绑定数据.模型数据输出时自动通过注解应用格式化的功能. 二.注解类型 1.DateTimeFormat @ ...

随机推荐

  1. Linux 常用命令 , 其他名 , 文件管理

    Linux 常用命令 , 其他名 , 文件管理 一丶Linux常用的指令 1. bsystemctl stop firewalld #关闭防火墙 2. iptables -F #清空防火墙规则 3. ...

  2. javascript format 字符串 函数

    函数实现如下: function format(string) { var args = arguments; var pattern = new RegExp("%([1-" + ...

  3. Android Xutils3 完全解析

    1.先来认识一下xUtils3 1)xUtils3简介 xUtils是基于Afinal开发的目前功能比较完善的一个Android开源框架,最近又发布了xUtil3.0,在增加新功能的同时又提高了框架的 ...

  4. 【学习笔记】大数据技术原理与应用(MOOC视频、厦门大学林子雨)

    1 大数据概述 大数据特性:4v volume velocity variety value 即大量化.快速化.多样化.价值密度低 数据量大:大数据摩尔定律 快速化:从数据的生成到消耗,时间窗口小,可 ...

  5. Odoo中的env详解

    转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/10826382.html 一:environment environment类提供了对ORM对象的封装,同时提 ...

  6. springboot+thymeleaf 实现图片文件上传及回显

    1. 创建一个springboot工程, 在此就不多说了(目录结构). 2. 写一个HTML页面 <!DOCTYPE html> <html lang="en" ...

  7. django 使用新的虚拟环境

    在原来环境中,项目根目录下,执行命令收集所有包 pip freeze > plist.txt 首先下载一个新虚拟环境,并且创建一个新的虚拟环境 sudo apt-get install pyth ...

  8. Go内置常用包

    strings 字符串函数 Contains(s, substr string) bool 字符串s是否包含字符串substr,包含返回true Split(s, sep string) []stri ...

  9. 前几天去电脑城升级了下主机配置(酷睿i3-9100F)

    因为自用电脑配置有点儿低了,前几天路过电脑城正好顺便升级下主机配置. 平时又不玩儿什么游戏,只是简单的使用,于是酷睿i3-9100F就成为了我的选择. 酷睿i3-9100F 四核四线程,不带核显(GP ...

  10. vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus

    报错: vue报这个错 [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for ex ...