hibernate - Spring-jpa 使用 spring-aop 动态代理?
问题描述
我想知道jpa“延迟加载”。所以,我尝试调试。但出现的第一堂课是JdkDynamicAopProxy.class
。和方法是invoke()
。
过去,我读过 jpa 的书。但我无法阅读。
spring-jpa 使用 Spring aop 动态代理?
我使用的 spring boot 版本是 '2.0.8' 和 'org.springframework.boot:spring-boot-starter-data-jpa'。
我尝试调试此代码。
User user = userRepository.findById(595525L)
.orElseThrow(() -> new IllegalArgumentException("does not exist user data"));
我找到了运行select
查询的代码。
final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializable {
...
@Override
@Nullable
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
....
invocation = new ReflectiveMethodInvocation(proxy, target, method, args, targetClass, chain);
retVal = invocation.proceed(); // here
....
}
解决方案
推荐阅读
- flutter - Flutter 中 ChangeNotifierProvider 和 ScopedModel 的区别
- javascript - 我可以知道为什么它不阅读声明吗?
- javascript - 使用php将结果html文件(包含js代码)导入mysql
- java - Dropbox 图标未出现在共享托盘中
- c# - 如何在所有条目都填满之前禁用按钮?
- c++ - 将 24 位“.bmp”图像转换为黑白/单色图像的可能算法是什么?
- c# - google oAuth 尝试重定向到与我的应用程序 url 不同的随机 uri
- javascript - 为什么按引用传递似乎在这段代码中不起作用,而 obj1.value 仍然是函数的外部
- excel - 使用单元格 B3 中的日期值重命名工作簿中的多个工作表
- .net-core - 如何将 EWS API 与 Console App Net Core 一起使用