ITeye博客

unproxy-a-spring-bean

roc08 · 2015-01-14 23:03 · 编程语言 · Markdown

http://stackoverflow.com/questions/8121551/is-it-possible-to-unproxy-a-spring-bean

http://stackoverflow.com/questions/4409456/how-to-unwrap-the-original-object-from-a-dynamic-proxy

http://www.techper.net/2009/06/05/how-to-acess-target-object-behind-a-spring-proxy/

http://jinnianshilongnian.iteye.com/blog/1613222

@SuppressWarnings({"unchecked"}) protected T getTargetObject(Object proxy, Class targetClass) throws Exception { if (AopUtils.isJdkDynamicProxy(proxy)) { return (T) ((Advised)proxy).getTargetSource().getTarget(); } else { return (T) proxy; // expected to be cglib proxy then, which is simply a specialized class } }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。