Files
spring-cloud-template/service-consumer/src/main/java/cn/hezhaohui/serviceconsumer/controller/ConsumeController.java
T

24 lines
698 B
Java
Raw Normal View History

2025-10-06 19:41:56 +08:00
package cn.hezhaohui.serviceconsumer.controller;
2025-10-07 00:57:54 +08:00
import cn.hezhaohui.serviceconsumer.client.ServiceProducerClient;
2025-10-06 19:41:56 +08:00
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
@RequestMapping("/api")
public class ConsumeController {
@Resource
2025-10-07 00:57:54 +08:00
private ServiceProducerClient serviceProducerClient;
2025-10-06 19:41:56 +08:00
@GetMapping("/print")
public String print() {
2025-10-07 00:57:54 +08:00
String number = serviceProducerClient.getNumber();
2025-10-06 19:41:56 +08:00
return "[Generate]: " + number;
}
}