有没有一种方法可以让我们以某种方式查看动态生成的 Java 类(例如由 JDKProxy 或 CGLIB 生成的代理)的内容 - 比如在 Eclipse 调试器 View 中或根据需要将其打印在日志文件中?
最佳答案
它在没有配置 aspects 的情况下工作吗?我建议您查看 ProceedingJoinPoint.proceed() 的文档再次,然后将其与您的方面实际在做什么进行比较。
编辑:这是一个提示
@Aspect
public class AstralMethodInterceptor {
private static final Logger LOG = LoggerFactory
.getLogger(AstralMethodInterceptor.class);
@Around("(execution(* com.kilo.proxyproxy.*.*(..)) || execution(* net.webservicex.*.*(..)) )")
public void handleMethod(ProceedingJoinPoint pjp) throws Throwable {
LOG.info("I encountered astral method in "
+ pjp.getThis().getClass().getCanonicalName());
pjp.proceed();
}
}
关于java - 查看动态生成的java类的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15515785/