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:
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.
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>