自從使用mac,啓動springboot項目是,通常都會卡在啓動界面10多秒,而後纔開始啓動項目 ,一直會卡在下面:spring
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.1.RELEASE)
有一次請教同事問題,發現他的項目啓動很快,細問之下,原來是須要作一個配置。springboot
打開hosts文件:oop
sudo vi /etc/hosts
能夠看到以下內容:this
# 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
只須要在最後一行裏面加上本身機器名便可,以下:code
::1 localhost ttk-mac.local
ttk-mac是個人mac機器名。至於如何查看機器名,最簡單的方法就是經過hostname
命令查看。ast
經過這個配置,能夠大幅提升spingboot項目在mac上的啓動速度。sed
小插曲:第一次配置時,粘貼錯了,粘貼成::1 localhos ttk-mact .local
,而後發現啓動項目時並無變快。因此,必定要細心啊~~~~配置