1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
public void sendObservation(JoinPoint joinPoint) {
Method interceptedMethod = getMethod(joinPoint);
logger.debug("Intercepted method ! in the Service Layer : " + interceptedMethod.getName());
Transactional annot = interceptedMethod.getAnnotation(Transactional.class);
if (annot != null && (annot.propagation() == Propagation.REQUIRED || annot.propagation() == Propagation.REQUIRES_NEW)) {
logger.debug("Intercepted method ! in the Service Layer : " + interceptedMethod.getName() + " has annotation REQUIRED or REQUIRES_NEW");
}
}
private Method getMethod(JoinPoint jp) {
Method invoked = null;
MethodSignature met = (MethodSignature) jp.getSignature();
try {
invoked = jp.getSourceLocation().getWithinType().getMethod(met.getMethod().getName(), met.getMethod().getParameterTypes());
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return invoked;
} |
Partager