From 465cd2d93fc8993fe5a8dced2c209c4697e29d82 Mon Sep 17 00:00:00 2001 From: zhangli <123879394@qq.com> Date: Mon, 7 Jul 2025 00:45:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 26 +++++++++++++------ .../gateway/controller/TestController.java | 4 ++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index de4be18..ad48f6a 100644 --- a/pom.xml +++ b/pom.xml @@ -71,15 +71,25 @@ + + + + + + + + + + + - org.springframework.cloud - spring-cloud-starter-loadbalancer - - - org.springframework.cloud - spring-cloud-commons - - + com.github.ben-manes.caffeine + caffeine + + + + org.springframework.boot + spring-boot-starter-cache diff --git a/src/main/java/com/sczx/gateway/controller/TestController.java b/src/main/java/com/sczx/gateway/controller/TestController.java index 107f4e0..d78b87b 100644 --- a/src/main/java/com/sczx/gateway/controller/TestController.java +++ b/src/main/java/com/sczx/gateway/controller/TestController.java @@ -1,5 +1,6 @@ package com.sczx.gateway.controller; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.discovery.DiscoveryClient; @@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; +@Slf4j @RestController public class TestController { @Autowired @@ -29,7 +31,7 @@ public class TestController { if (instance == null) { return "No instance chosen!"; } - + log.info("Chosen instance: {}", instance.getUri()); return "Chosen instance: " + instance.getUri(); } }