Results 1 to 2 of 2

Thread: semi programmatic approach

  1. #1
    Join Date
    Nov 2007
    Posts
    2

    Thumbs down semi programmatic approach

    Im trying to proxy an object that is not instantiated from the bean factory. So the usual programmtic approach using the ProxyFactory works fine. However I would prefer to use a more declarative approach where I get my ProxyFactoryBean from a configuration file and set the target programmatically. Something like:

    Code:
        ProxyFactoryBean pfb = (ProxyFactoryBean)lbf.getBean("&proxyBean");
        pfb.setTarget(targetObjectInstantiatedElsewhere)
        TargetObjectClass tac = (TargetObjectClass)pfb.getObject();
        tac.hello(); //test interceptor
    
    <bean id="proxyRequestBean"
      class="org.springframework.aop.framework.ProxyFactoryBean">
      <property name="interceptorNames">
        <list>
    	<value>advisorBean_1</value>
    	<value>advisorBean_n</value>
        </list>
      </property>
    </bean>
    As neither an interface nor a target has been supplied declaratively it doesnt work. Should I forget about this semi declarative approach and use the ProxyFactory or is there something I've missed? Using Spring 1.2.7. Cheers Niklas.

  2. #2
    Join Date
    Nov 2005
    Location
    Reutlingen, Germany
    Posts
    2,098

    Default

    What happens if you declare the bean as abstract. Maybe this enables the access to the FactoryBean without creating a bean since they don't get instantiated.

    Joerg
    This post can contain insufficient information.

Posting Permissions

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