GateWay 转发失败
来源:10-3 编写Spring Cloud Gateway

慕粉1890165
2023-05-10
gateway的yml:
server:
port: 8040
spring:
application:
name: gateway
zipkin:
base-url: http://localhost:9411/
discoveryClientEnabled: false
sleuth:
sampler:
# 抽样率,默认是0.1(10%)
probability: 1.0
cloud:
nacos:
discovery:
server-addr: 172.31.153.131:8848
gateway:
discovery:
locator:
# 让gateway通过服务发现组件找到其他的微服务
enabled: true
management:
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
logging:
level:
org.springframework.cloud.gateway: trace
需要通过gateway转发调用的接口
@RestController
public class AstonMartinICallController {
@Resource
private AstonMartinICallService astonMartinService;
@GetMapping(value = "/test1")
public String test() {
return astonMartinService.test(12345);
}
}
为什么gateway转发不了呢?
写回答
1回答
-
大目
2023-05-11
代码目测没啥问题,建议看看是不是缺依赖
如果和课上版本不同需要保证有以下依赖
spring-cloud-starter-gateway
spring-cloud-starter-loadbalancer
spring-cloud-starter-actuator
00
相似问题
gateway如果转发到页面
回答 1
gateway问题
回答 1