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

Transactional attribute is not resolved on CgLib proxies created by FactoryBeans

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 2.5.6
    • Fix Version/s: 3.0.4
    • Component/s: Transaction
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      When FactoryBean creates CgLib proxy via programmatic Spring proxy support (ie. ProxyFactory), @Transactional annotation on methods of original class are not picked by the transactional infrastructure. Reason is that the CgLib doesn't copies annotations on methods to the created final subclass and these annotations are not subject of inheritance.

      See Jurgen Hoeller expression: https://jira.springframework.org/browse/SPR-975?page=com.atlassian.jira.plugin.system.issuetabpanels%253Aall-tabpanel

      There is also open bug on CgLib - but I think it will never get resolved as the CgLib seems quite abadoned now: http://sourceforge.net/tracker/?func=detail&aid=2255414&group_id=56933&atid=482371

      There is very simple solution that would address this issue (documented in attached file).

      Issue is described in this blog post <http://blog.novoj.net/2010/08/10/when-does-your-spring-transactional-attribute-apply-on-cglib-proxies/> in more detail.

      Proposed solution is available at (see commentaries in referenced article): http://github.com/novoj/SpringTransactionTest

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              novoj Jan Novotný
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 45 weeks, 4 days ago