Results 1 to 2 of 2

Thread: TransactionProxyFactoryBean for non-singleton

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    San Jose, CA
    Posts
    24

    Default TransactionProxyFactoryBean for non-singleton

    The Javadoc for org.springframework.transaction.interceptor.Transa ctionProxyFactoryBean says,

    “This class is intended to cover the typical case of declarative transaction demarcation: namely, wrapping a (singleton) target object with a transactional proxy, proxying all the interfaces that the target implements.”
    (emphasis added).

    I can't quite get my arms around why this is only possible with singleton classes. Is this truly the case? Or is the singleton just a recommendation and I have other problems?

    - Justin Makeig

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Justin, the comment is correct. (Of course the reference to "singleton" means a Spring singleton-scoped bean, not a GoF Singleton, but I'm sure you're aware of that.)

    TransactionProxyFactoryBean's pre and post interceptors lists are lists of bean references, rather than bean names (like ProxyFactoryBean's interceptorNames list). While this is a bit more intuitive and appropriate for common use, it means that you can't control whether or not an independent instance of each Advisor should be used for distinct proxies, and hence you don't have the full control that ProxyFactoryBean gives you over the shared/non-shared nature of both the target and all Advisors.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. Is a 'singleton' flow a bad idea?
    By akw in forum Web Flow
    Replies: 4
    Last Post: Oct 6th, 2005, 01:16 AM
  2. Replies: 4
    Last Post: Oct 5th, 2005, 11:04 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 6
    Last Post: May 25th, 2005, 01:56 AM
  5. DefaultAdvisorAutoProxyCreator skipping beans
    By youngm in forum Container
    Replies: 6
    Last Post: Apr 12th, 2005, 04:29 PM

Posting Permissions

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