2021-12-27 00:53:46.436 ERROR 7760 --- [nio-9093-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.ResourceAccessException: I/O error on GET request for "localhost://9092/user/out": unknown protocol: localhost; nested exception is java.net.MalformedURLException: unknown protocol: localhost] with root cause
@RestController
@RequestMapping("/consumer")
public class ConsumerController {
private final RestTemplate restTemplate;
public ConsumerController(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@RequestMapping("/find")
public String findAll(){
String url="http://localhost://9092/user/out";
String str = restTemplate.getForObject(url, String.class);
System.out.println(str);
return str;
}
}