Results 1 to 2 of 2

Thread: Transactional on AspectJ Interceptors

  1. #1
    Join Date
    Sep 2007
    Posts
    5

    Default Transactional on AspectJ Interceptors

    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:

    Code:
    @Transactional(propagation=Propagation.NESTED, rollbackFor=CustomException.class)
    public String someMethod(String a, String b) throws CustomException {
      ...
    }
    I am not sure how to configure this. Simply using the following code:

    Code:
    <aop:aspectj-autoproxy />
    <tx:annotation-driven transaction-manager="transactionManager" order="20"/>
    disregards Transactional attributes in the interceptor.

  2. #2
    Join Date
    Mar 2007
    Posts
    515

    Default

    Take a look at this thread for an example of logging database access:
    http://forum.springframework.org/showthread.php?t=9945

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •