feat:optimize quickstart feign examples.

pull/1190/head
Haotian Zhang 1 year ago
parent d5dac7678a
commit 8eec75a8ee

@ -65,9 +65,9 @@ public class QuickstartCalleeController {
* @return sum * @return sum
*/ */
@GetMapping("/sum") @GetMapping("/sum")
public int sum(@RequestParam int value1, @RequestParam int value2) { public String sum(@RequestParam int value1, @RequestParam int value2) {
LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2); LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2);
return value1 + value2; return String.format("Quickstart Callee Service [%s:%s] is called and sum is [%s].", ip, port, value1 + value2);
} }
/** /**

@ -69,9 +69,9 @@ public class QuickstartCalleeController {
* @return sum * @return sum
*/ */
@GetMapping("/sum") @GetMapping("/sum")
public int sum(@RequestParam int value1, @RequestParam int value2) { public String sum(@RequestParam int value1, @RequestParam int value2) {
LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2); LOG.info("Quickstart Callee Service [{}:{}] is called and sum is [{}].", ip, port, value1 + value2);
return value1 + value2; return String.format("Quickstart Callee Service [%s:%s] is called and sum is [%s].", ip, port, value1 + value2);
} }
/** /**

@ -37,5 +37,5 @@ public interface QuickstartCalleeService {
* @return sum * @return sum
*/ */
@GetMapping("/quickstart/callee/sum") @GetMapping("/quickstart/callee/sum")
int sum(@RequestParam("value1") int value1, @RequestParam("value2") int value2); String sum(@RequestParam("value1") int value1, @RequestParam("value2") int value2);
} }

@ -28,7 +28,7 @@ import org.springframework.stereotype.Component;
public class QuickstartCalleeServiceFallback implements QuickstartCalleeService { public class QuickstartCalleeServiceFallback implements QuickstartCalleeService {
@Override @Override
public int sum(int value1, int value2) { public String sum(int value1, int value2) {
return 0; return "sum is 0.";
} }
} }

@ -62,7 +62,7 @@ public class QuickstartCallerController {
* @return sum * @return sum
*/ */
@GetMapping("/feign") @GetMapping("/feign")
public int feign(@RequestParam int value1, @RequestParam int value2) { public String feign(@RequestParam int value1, @RequestParam int value2) {
return quickstartCalleeService.sum(value1, value2); return quickstartCalleeService.sum(value1, value2);
} }

Loading…
Cancel
Save