PDA

View Full Version : Referencing autoproxied target


Alef Arendsen
Sep 17th, 2004, 03:56 AM
A user in the webforum (http://forum.springframework.org/showthread.php?t=10357) was wondering whether or not it's possible to reference or reach a proxied object creating by an AutoProxyCreator (so not hte proxy, but target itself).

The FactoryBean has support for reaching the factorybean itself instead of objects it creates (prefix an ampersand). Wouldn't it be a nice features to allow autoproxied objects to referenced the same way?

Rod, anyone, opinions?

Rod Johnson
Sep 17th, 2004, 08:27 AM
Programmatically you can cast the reference to Advised and get the target source from there. If it's a simple target, it will be of type SingletonTargetSource.

The problem with a mechanism like the ampersand is that it wouldn't work for dynamic target sources, which may return a different target instance on each invocation.