aop aspectj [intellij idea配置] [hello world]
来源:互联网 发布:淘宝的优质网店 编辑:程序博客网 时间:2024/05/18 03:53
实验环境
操作系统:windows
开发工具:intellij idea
编程语言:java
工具准备
intellij idea【必须 Ultimate 】
http://blog.csdn.net/qqduxingzhe/article/details/76971479
aspectj jar包
http://mirror.library.ucy.ac.cy/eclipse/tools/aspectj/aspectj-1.8.10.jar
安装aspectj
前置条件,java jdk环境
双击 aspectj xx.jar ,默认即可
新建java项目,添加aspectj jar包
配置编译器 ajc
编写代码并运行
helloworld
public class HelloWorld { public void sayHello(){ System.out.println("hello world"); } public void saySome(String some){ System.out.println("some=" + some); }}
aspectjhello
public aspect AspectHello { pointcut beforeSayXX(): execution(void HelloWorld.say**(..)); before(): beforeSayXX(){ System.out.println("-----------------------------do some "); }}
client test
public class Client { public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); helloWorld.sayHello(); helloWorld.saySome("ni hao"); }}
aspectj 语法
pointcut beforeSayXX(): execution(void HelloWorld.say**(..));
pointcut 定义一个切入点
beforeSayXX 切入点名称
–
: 后接执行方式(call、execution)
(void ) 要切入的方法的返回值类型
( HelloWorld.say**(..)) 要切入方法的 包名.类名.方法名(参数类型)
( say** ) **指的是通配符,这样可以切入多个方法
( say**(..)) ..指参数类型不限制,任意参数,任意类型,任意参数个数,为的是切入更多方法
=====================
before(): beforeSayXX(){ System.out.println("-----------------------------do some "); }
before() 声明在切入点方法之前要做的操作
-
: 后接切入点名称
aspectj学习文档
aspectj 专栏
http://blog.csdn.net/column/details/aspectj.html
aspectj cookbook 中文版pdf
https://cn.bing.com/search?q=aspectj+cookbook+%E4%B8%AD%E6%96%87%E7%89%88+pdf
aspectj in action pdf【英文】
intellij aspectj 配置
https://www.jetbrains.com/help/idea/2016.3/aspectj.html
end
- aop aspectj [intellij idea配置] [hello world]
- Intellij Idea maven hello world
- IntelliJ Idea搭建Groovy环境Hello World
- 使用Intellij IDEA编写Spring Hello World
- Scala从零开始:使用Intellij IDEA写hello world
- Scala从零开始:使用Intellij IDEA写hello world
- 【转】Scala从零开始:使用Intellij IDEA写hello world
- intellij idea Spring MVC 学习之Hello World
- spring boot 入门(一):IntelliJ IDEA 实现hello world
- Intellij Idea系列之简单Hello World(2)
- 使用 IntelliJ IDEA + Gradle + SpringBoot 搭建Hello World工程
- IntelliJ IDEA 创建 hello world Java web Maven项目
- 使用 IntelliJ IDEA + Gradle + SpringBoot 搭建Hello World工程
- IntelliJ IDEA 开发Spring-Boot之Hello World
- IntelliJ IDEA Kotlin第一步从hello world开始
- IntelliJ IDEA 创建spring boot 的Hello World 项目
- AOP的hello world
- intellij idea 初识,Hello Idea!!
- Python爬虫(一):爬取单页面
- static详解
- Happy Tree Friend!(递归模拟)
- nodejs中req里使用的东西
- HR面试,你需要注意什么?
- aop aspectj [intellij idea配置] [hello world]
- WSGI简介
- C++Primer--string、vector、iterator
- MongoDB入门篇(一)
- 系统启动流程
- VS链接提示无法解析的外部符号 __imp__fopen解决办法
- 正则表达式匹配
- MySQL中常用的存储引擎之Innodb
- nodejs模拟表单提交