Results 1 to 3 of 3

Thread: ProxyFactoryBean

  1. #1
    Join Date
    Sep 2004
    Posts
    21

    Default ProxyFactoryBean

    I'm reading section

    http://www.springframework.org/docs/...p.html#d0e3285

    that gives an example on how to configure ProxyFactoryBean

    Code:
    <bean id="person" 
        class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces"><value>com.mycompany.Person</value></property>
    
        <property name="target"><ref local="personTarget"/></property>
        <property name="interceptorNames">
            <list>
                <value>myAdvisor</value>
                <value>debugInterceptor</value>
            </list>
        </property>
    </bean>
    My question is what if class PersonImpl of the above example implements more than one interface?

    I`m asking because of the following situation:

    Let's assume a "PersonImpl" extends AbstractPerson
    and AbstractPerson implements 2 interfaces, let's say interfaceA and interfaceB.

    Now I have to decide which interface is the "right" interface for the property "proxyInterfaces" A or B? But If I stayed with A I loose the business functionality of B and vice versa.

    Is this a real problem or am I just doing things the wrong way?

    Maybe I have to pass all implemented interfaces in a list?

    Code:
    <property name="proxyInterfaces">
            <list>
                <value>interfaceA</value>
                <value>interfaceB</value>
            </list>
    </property>
    Thank you!
    Mo

  2. #2
    Join Date
    Aug 2004
    Posts
    109

    Default

    note the name of the attribute proxyInterfaces is plural. It is usually a good indicator in Spring that things can be multiple (or a list). So

    Code:
    <property name="proxyInterfaces">
       <list>
          <value>com.mycompany.Person</value>
          <value>com.mycompany.AnotherInterface</value>
       </list>
    </property>
    should work.[/code]
    Thanks,
    Alex.

  3. #3
    Join Date
    Sep 2004
    Posts
    21

    Default

    yep now it does... I had problems with my code but because of other things! thanks.

Similar Threads

  1. Replies: 6
    Last Post: Sep 28th, 2005, 04:14 PM
  2. Replies: 6
    Last Post: Apr 21st, 2005, 06:41 PM
  3. Help: ProxyFactoryBean + non-singletons
    By cptechno in forum AOP
    Replies: 6
    Last Post: Jan 13th, 2005, 04:16 PM
  4. Replies: 1
    Last Post: Dec 14th, 2004, 11:53 PM
  5. ProxyFactoryBean proxying singleton
    By bst@jcs.be in forum AOP
    Replies: 2
    Last Post: Nov 22nd, 2004, 09:21 AM

Posting Permissions

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