背景:公司內部系統的架構升級准備用微服務一套;記錄遇到的坑。
錯誤信息:
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 "http://PROVIDER/add": PROVIDER;
nested exception is java.net.UnknownHostException: PROVIDER] with root cause
java.net.UnknownHostException: PROVIDER
看到有人說修改localhost 為本機IP 嘗試也沒有效果
上面是引起錯誤的代碼。
這是正確的代碼
加上@LoadBalanced