http://localhost:8090/getStudentName?studentName=wangwu
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sun Jun 23 21:57:37 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
400 null
Sun Jun 23 22:02:32 CST 2019
There was an unexpected error (type=Internal Server Error, status=500).
com.netflix.client.ClientException: Load balancer does not have available server for client: client
服务发布类
@RestController
public class StudentController {
@GetMapping("getStudentName")
public String getStudentName(@RequestParam("studentName")String studentName) {
return "hellworld";
}
}
服务restTemplate 和FeignClient调用带参数
@Autowired
private RestTemplate restTemplate;
@Autowired
private StudentService studentService;
@GetMapping("getStudentName")
public String getStudentName(@RequestParam("studentName")String studentName) {
return restTemplate.getForObject("http://eureka-server/getStudentName", String.class,studentName);
}
@GetMapping("getStudentNameByFeign")
public String getStudentNameByFeign(@RequestParam("studentName")String studentName) {
return studentService.getStudentNameByFeign(studentName);
}
Feign client 接口类
public interface EurekaClientFeign{
@GetMapping("getStudentName")
public String getStudentName(@RequestParam("studentName")String studentName);
}
服务层实现
@Service
public class StudentService {
@Autowired
private EurekaClientFeign client;
public String getStudentNameByFeign(String studentName) {
return client.getStudentName(studentName);
}
}
请问出现上述问题,调用无参数数的是没有任何问题,请教哪位大佬给予提供解答