标签:res 上启 boot too cond 解析 pre 复制 本机
在启动springboot项目的时候,会停顿好长时间才开始打印日志。
对于强迫症这是受不了的。
查看第一行的日志打印。
InetAddress.getLocalHost().getHostName() took 5004 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
这行日志可以看出它去解析hostname的时间就花了5秒多。
这里说明了它去解析了hosts文件。 macOS machines may need to add entries to /etc/hosts
1、查看本机的hostname是什么
~ hostname
han.sun-mac-pro.local
2、查看hosts文件里面配置的是什么
broadcasthost
~ vim /private/etc/hosts 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
3、复制hostname
127.0.0.1 localhost 你的机器名.local 255.255.255.255 broadcasthost ::1 localhost 你的机器名.local
4、:wq或者:x可能修改不了文件
:w !sudo tee %
5、再去启动springboot项目就变得飞快了
标签:res 上启 boot too cond 解析 pre 复制 本机
原文地址:https://www.cnblogs.com/han-sun/p/12627850.html