package com.sf.eurekaclientdemo2.controller; import com.sf.eurekaclientdemo2.dto.User; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class SupplierController { // http://eureka-client-supplier-demo/clientDemo2 // http://localhost:18092/clientDemo2 // http://localhost:18093/clientDemo2 @GetMapping("/clientDemo2") public String handler() { String data = "client demo 2 success"; System.out.println(data); return data; } // http://localhost:18092/testId/1 @GetMapping("/testId/{id}") public String testId(@PathVariable("id") String id) { System.out.println("handler testId: " + id); return "TestId Success"; } // http://localhost:18092/testParam?param=111 @GetMapping("/testParam") public String testParam(@RequestParam("param") String param) { System.out.println("handler testParam: " + param); return "TestParam Success"; } // http://localhost:18092/testUser?name=zhangsan&desc=something // private String name; // private String desc; @GetMapping("/testUser") public String testUser(User user) { System.out.println("handler testUser: " + user); return "TestUser Success"; } }