package com.epmet.lbtest.controller; import com.epmet.lbtest.feign.TestCallFeignClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("lb") public class LbController { @Autowired private TestCallFeignClient testCallFeignClient; @GetMapping("test") public String test(HttpServletRequest request) { String localAddr = request.getServerName(); return localAddr; } @GetMapping("test-cal") public String testCall() { String result = testCallFeignClient.test(); System.out.println("调用结果:" + result); return result; } }