From b4760cab969400b43c82b7c9090f260656e5f712 Mon Sep 17 00:00:00 2001 From: Wonder Date: Sat, 18 Oct 2025 23:02:08 +0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=93=9DDocs:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E4=BA=8E=20@Lazy=20=E7=9A=84=E8=A7=A3=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59fac41..617aeee 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,11 @@ 答:对于 `thumb` 表,使用联合唯一索引 ```mysql CREATE UNIQUE INDEX idx_userId_blogId ON thumb (userId, blogId); -``` \ No newline at end of file +``` + +2. 为什么要在 `BlogServiceImpl` 导入 `ThumbService` 上加 `@Lazy` + +答: +- 博客服务中需要使用点赞服务查询博客对应的点赞情况列表以返回对应视图。 +- 点赞服务中需要使用博客服务更新单条博客的点赞计数器。 +- 两个服务之间产生了**循环依赖**,Spring Boot 2.6 以后的版本默认不允许循环依赖,这里可以使用懒加载的方式避免这一问题。 \ No newline at end of file