测试接口调试

This commit is contained in:
2025-07-07 00:45:50 +08:00
parent d0a2120f29
commit 465cd2d93f
2 changed files with 21 additions and 9 deletions

26
pom.xml
View File

@ -71,15 +71,25 @@
</dependency>
<!-- LoadBalancer 支持 lb:// 协议 -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-starter-loadbalancer</artifactId>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-commons</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</exclusion>
</exclusions>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<!-- Actuator 监控 -->

View File

@ -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();
}
}