一.Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Aug 17 13:04:44 CST 2021
There was an unexpected error (type=Internal Server Error, status=500)
错误原因1:
url地址最后少加了"/"号,无法拼接参数
@GetMapping("/consumer/echo/{msg}")
public String doRestEcho1(@PathVariable("msg") String msg){
String url = "http://localhost:8081/provider/echo"+msg;//错误处
String result = restTemplate.getForObject(url,String.class);
return server + "get result is " + result ;
}
}
改正
@GetMapping("/consumer/echo/{msg}")
public String doRestEcho1(@PathVariable("msg") String msg){
String url = "http://localhost:8081/provider/echo/"+msg;//改正
String result = restTemplate.getForObject(url,String.class);
return server + "get result is " + result ;
}
}
正确结果:
错误原因2:
拦截器方法缺少@LoadBalanced注解
改正: