Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16987

AspectJ aspect for @javax.transaction.Transactional is not initialised by default

    XMLWordPrintable

    Details

    • Last commented by a User:
      true

      Description

      If I

      a) use Spring transaction management in the AspectJ mode
      ( @EnableTransactionManagement(mode = AdviceMode.ASPECTJ) )

      b) use the javax.transaction.Transactional annotation instead of org.springframework.transaction.annotation.Transactional

      then

      a) it doesn't work out of the box - transactions are not created around annotated methods.

      b) I get "Skipping transactional joinpoint [<removed>] because no transaction manager has been configured" in the logs (if I enable spring debug logging).

      This seems to be because the default configuration in AspectJTransactionManagementConfiguration only initialises AnnotationTransactionAspect but not JtaAnnotationTransactionAspect. So the JtaAnnotationTransactionAspect gets woven in by aspectJ compiler and executed but because it is not initialised with the transaction manager it cannot create transactions.

      As a workaround, I can initialise it myself but declaring

      @Bean@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
      public JtaAnnotationTransactionAspect jtaTransactionAspect() {
      return JtaAnnotationTransactionAspect.aspectOf();
      {color}}

      But could you please add it to the default configuration so that it works out of the box.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              mikebl71 Mike B
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 23 weeks, 6 days ago