PDA

View Full Version : "target property" or "last entry in intercept


liuzh
Aug 30th, 2004, 05:02 AM
Hi,

I put the bean to be proxied in the property@name="target", and set a property@name="singleton" to true for ProxyFactoryBean. This gives me an exception saying that name is null when refreshing target. I found that the exception is thrown in the method refreshTarget().

after reading the src, I found that when using "prototype" (singleton=false), ProxyFactoryBean expects the targetsource to be appended as the last entry in interceptorNames, and not in the "target" property. Is this the desired behaviour? using the "target" property alone works fine if I set singleton to true.

Thanks..

Zehua Liu

Rod Johnson
Aug 30th, 2004, 07:47 AM
Yes, this is normal behaviour. In the case of a prototype, the config needs to specify the bean name of the target, rather than have a reference, as the target instance will vary each time, and results from a BeanFactory lookup performed when a proxy is created by ProxyFactoryBean.