views:

208

answers:

2
+2  A: 

You can cast the proxied object to get the object and class it acts as a proxy for (see TargetSource):

Advised advised = (Advised) proxy;
Class<?> cls = advised.getTargetSource().getTargetClass();

Generally you should follow the Spring principles and keep obtaining the correct class as unobtrusive as possible. Meaning that as little classes as possible should depend on the Spring Framework APIs (maybe add a ClassLocator and a SpringProxyClassLocator implementation).

Daff
+4  A: 

Spring's interface-based proxies implement TargetClassAware.

axtavt
nice... :) (+1)
Bozho