Hi
I need to intercept all my method with this annotation :
So, i created this class :Code:package com.annotations; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Inherited @Documented @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface MyBatch { BatchType batchType(); }
But when start my applications, i don’t see the poincut executed ! it is just ignored!.Code:package com.common.aspects; @Aspect @Component public class AOPBatch { @Around(@annotation(com.annotations.MyBatch )") public Object logTimeMethod(ProceedingJoinPoint joinPoint) throws Throwable { ........... } }
While, if i try :
or :Code:package com.common.aspects; @Aspect @Component public class AOPBatch { @Around(@annotation(org.springframework.transaction.annotation.Transactional)") public Object logTimeMethod(ProceedingJoinPoint joinPoint) throws Throwable { ........... } }
It's work fine.. Why??Code:package com.common.aspects; @Aspect @Component public class AOPBatch { @Around("execution(* com.*.personal.*.al.service.impl.*.*(..))") public Object logTimeMethod(ProceedingJoinPoint joinPoint) throws Throwable { ........... } }
ps.i use :
<spring.version>3.1.1.RELEASE</spring.version>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.0</version>
</dependency>


Reply With Quote