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

ProxyFactoryBean does not work with prototype advisors/interceptors

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.1.1
    • Component/s: Core:AOP
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      There are several issues in the ProxyFactoryBean which prevent it from correctly creating beans with prototype advisors:

      -Cannot create proxy when using prototype advisor when singleton=false
      -Cannot create proxy when using prototype interceptor when singletone=false
      -Cannot create proxy when using singleton target and singleton=false (ie, to use a prototype advisor on a singleton target)

      Essentially, at the moment the only part of a prototype ProxyFactoryBean which may be a prototype is the target bean.

      When trying to use a prototype the following exception is thrown:

      BeanCreationException: Error creating bean with name 'prototypeTestBeanProxySingletonTarget' defined in class path resource [proxyFactoryTests.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: TargetSource specified more than once: Specify in targetSource property or at the END of the interceptorNames list
      ...

      Note that in targetSource is not actually specified more than once.

      The main defect is that when the factory is initialized, it avoids loading prototype beans which appear in the interceptorNames property in order to improve performance. Instead it substitutes a null value. When this null value is later examined, it cannot be determined whether the bean was supposed to be a target or an advisor.

      1. ProxyFactoryBean.patch
        9 kB
        Chris Eldredge
      2. ProxyFactoryBean.patch
        10 kB
        Chris Eldredge

        Activity

        lordtrumpet Chris Eldredge created issue -
        lordtrumpet Chris Eldredge made changes -
        Field Original Value New Value
        Attachment ProxyFactoryBean.patch [ 10213 ]
        lordtrumpet Chris Eldredge made changes -
        Attachment ProxyFactoryBean.patch [ 10220 ]
        juergen.hoeller Juergen Hoeller made changes -
        Fix Version/s 1.1.1 [ 10120 ]
        rod.johnson Rod Johnson made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Juergen Hoeller [ juergen.hoeller ] Rod Johnson [ rod.johnson ]
        Resolution Fixed [ 1 ]
        rod.johnson Rod Johnson made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        tmarshall Trevor Marshall made changes -
        Workflow jira [ 10550 ] SPR Workflow [ 37904 ]
        tmarshall Trevor Marshall made changes -
        Workflow SPR Workflow [ 37904 ] New SPR Workflow [ 58776 ]
        tmarshall Trevor Marshall made changes -
        Workflow New SPR Workflow [ 58776 ] SPR Workflow [ 67792 ]

          People

          • Assignee:
            rod.johnson Rod Johnson
            Reporter:
            lordtrumpet Chris Eldredge
            Last updater:
            Trevor Marshall
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              13 years, 20 weeks, 4 days ago