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 ...