Sprint Boot: InetAddress took long time
Mar 18, 2021
เขียน Java Spring Boot แล้วขึ้นว่า InetAddress.getLocalHost().getHostName() took 5005 milliseconds to respond ที่ Terminal ครับ
คือนานกว่าโปเจกต์จะรัน โปรแกรมเมอร์ก็บอก ช้า ช้า ช้า ตัวโปรแกรมก็แจ้งว่า Please verify your network configuration (macOS machines may need to add entries to /etc/hosts)
InetAddress.getLocalHost().getHostName() took 5005 milliseconds to respond แก้ไขอย่างไร? ตอบ เครื่อง Mac ตรงไปยัง /etc/hosts พิมพ์รูปแบบนี้
127.0.0.1 localhost <your-host-name.local>255.255.255.255 broadcasthost::1 localhost <your-host-name.local>
ตัวอย่าง
127.0.0.1 localhost Kittipongs-MacBook-Pro.local255.255.255.255 broadcasthost::1 localhost Kittipongs-MacBook-Pro.local
ได้ว่าเร็วปิ๊ดๆเลยครับ