打開/etc/hosts文件
原始內(nèi)容大概如下:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
修改內(nèi)容, 加入'你的機(jī)器名.local'
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost 你的機(jī)器名.local
255.255.255.255 broadcasthost
::1 localhost 你的機(jī)器名.local
如何查看機(jī)器名
方式一:

屏幕快照 2018-04-20 06.23.24.png
紫色方框內(nèi)的內(nèi)容就是: 你的機(jī)器名.local
方式二:
打開終端, 輸入命令hostname
原先運(yùn)行一個最簡單的springboot項目(helloword), 需要16秒(指定了logback配置文件,不指定的時候大概要11秒), 修改了hosts文件之后, 2s就可以啟動了
其它補(bǔ)充說明
Visual VM在mac也會要很久才能加載出左側(cè)的local內(nèi)容, 解決方案也是修改/etc/hosts文件, 添加127.0.0.1到hostname的映射