📄 mysecuritymanagerimpl.java
字号:
package com.bjsxt.spring;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
/**
* 定义切面
*/
@Aspect
public class MySecurityManagerImpl implements MySecurityManager {
/**
* 定义一个切入点,切入点的名称:allAddMethod(该方法的返回值需要是void,该
* 方法只是一个标识),切入点的内容是一个表达式,以描述需要横切那些对象的那些方法
* 的调用
*
* 具体表达是式的用法,参考spring文档6.2.3.4章节
*/
@Pointcut("execution(* add*(..)) || execution(* del*(..)) || execution(* modify*(..))")
private void allAddMethod() {}
/**
* 定一个advice,标识在那些切入点的何处插入本方法
*/
@Before("allAddMethod()")
public void checkSecurity() {
//...
//...
System.out.println("进行安全检查!!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -