Hi, I wish to define an interceptor which logs requests to a certain table in the database. Currently, my interceptor looks something like:
Code:@Around("execution(public * com.xyz.abc.SomeClass.someMethod*(..))") @Transactional(propagation=Propagation.REQUIRED) public Object handleRequest(ProceedingJoinPoint pjp) throws Throwable { ... try { basicErrorChecking(); pjp.proceed(); } catch (SomeException ex) { logExceptionInDatabase(ex); } ... }
And on the target:
I am not sure how to configure this. Simply using the following code:Code:@Transactional(propagation=Propagation.NESTED, rollbackFor=CustomException.class) public String someMethod(String a, String b) throws CustomException { ... }
disregards Transactional attributes in the interceptor.Code:<aop:aspectj-autoproxy /> <tx:annotation-driven transaction-manager="transactionManager" order="20"/>


Reply With Quote