Via Reflection:
Class c = Class.forName("mypackage.DiodeService");
Method m = c.getDeclaredMethod("blink");
Object t = c.newInstance();
Object o = m.invoke(t);
Method from DiodeService is invoked:
@ValueGreaterThan
public void blink(){
log.info("Diode service: blink()");
}
On the annotation @ValueGreaterThan is listening aspect:
@Around(value = "mypackage.CommonJoinPointConfig.valueGreaterThanAspect())") public void around(ProceedingJoinPoint joinPoint) throws Throwable {
log.info("Value greater than aspect {}", joinPoint); }
BUT: The around advice is never intercepted, when calling method by "invoke".
Around advice is intercepted normally, when calling by diodeService.blink()
Please, any ideas?
Aucun commentaire:
Enregistrer un commentaire