Announcement Announcement Module
Collapse
No announcement yet.
semi programmatic approach Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X