java - Unable to detect class level custom annotation in Spring AOP -


i trying intercept classes in spring following settings

interceptor

@aspect @component public class myinterceptor {      @around("execution(* com.example.services..*(..))")     public object intercept(proceedingjoinpoint pjp) throws throwable {         if (pjp.gettarget() != null && pjp.gettarget().getclass().getannotation(myannotation.class) != null) {             system.out.println("yes annotation present");         } else {             system.out.println("annotation not present");         }          return = pjp.proceed();     }    } 

and class being intercepted follows

@component @myannotation public class myalert implements ialert {  } 

every thing working fine until , unless make following changes

@configuration @propertysource(value = { "file:${catalina.home}/conf/my.properties" }) @component @myannotation public class myalert implements ialert {     @autowired     private environment environment; }  

i wanted read properties located in conf folder of tomcat7, after making these changes interceptor unable read custom annotation @myannotation. says (custom message written in interceptor)

annotation not present

and here custom annotation

@retention(retentionpolicy.runtime) public @interface myannotation {  } 

i want class should intercepted , annotation must detected on class if annotated. want read properties conf folder in intercepted class.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -