spring @AspectJ @annotation
来源:互联网 发布:万国数据事件 编辑:程序博客网 时间:2024/06/14 15:27
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.8.7</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.8.7</version> </dependency>``
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyTrans {
}
@Component
public class Hello implements IHello {
@MyTrans@Overridepublic void sayHello(String name) { System.out.println("hello world-" + name);}
}
@Aspect
@Component
public class TransAspect {
@Around(“@annotation(com.fd.annotation.MyTrans)”)
public Object around(ProceedingJoinPoint pjp) throws Throwable {
System.out.println(“前置”);
Object o = pjp.proceed();
System.out.println(“后置”);
return o;
}
}
<aop:aspectj-autoproxy /> <context:component-scan base-package="com.fd"></context:component-scan>
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("main.xml"); IHello helo = context.getBean(IHello.class); helo.sayHello("fudong");}
0 0
- Spring AOP + AspectJ annotation
- spring @AspectJ @annotation
- Spring AspectJ Aop Annotation
- aspectj annotation- used in spring
- Spring AOP + AspectJ Annotation Example
- Spring AOP + AspectJ Annotation Example
- Spring AOP + AspectJ Annotation Example
- spring aop + aspectj annotation example
- Spring AOP + AspectJ annotation example
- Spring AOP + AspectJ annotation example
- Spring AOP + AspectJ annotation example
- Spring Annotation AspectJ 源码分析
- Spring基于annotation的AOP(AspectJ)
- Spring-AOP @AspectJ切点函数之@annotation()
- 【Spring 基础篇四】annotation+aspectj实现AOP
- Spring AOP技术(基于AspectJ)的Annotation开发
- spring整合aspectj实现aop的;一个简单案例(annotation)
- Spring + AspectJ
- Xcode中的全局异常断点
- Xcode调试非异常导致崩溃的程序
- Hibernate3.2 断网之后报无法解析hibernate.cfg.xml错误
- xcode 连接 github
- Python Module_sys/random
- spring @AspectJ @annotation
- BZOJ 4292([PA2015]Równanie-数学)
- Android细节—— 权重预分配
- BZOJ 2797 [Poi2012]Squarks 数学
- AFNetworking怎么使用HTTPS协议
- BZOJ 3834 [Poi2014]Solar Panels 数学
- android studio快捷键
- linux下进程的最大线程数、进程最大数、进程打开的文件数
- Mini汽车的保养周期