码迷,mamicode.com
首页 > 编程语言 > 详细

mac上启动springboot项目很慢的解决方案

时间:2020-04-03 18:27:50      阅读:1197      评论:0      收藏:0      [点我收藏+]

标签: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项目就变得飞快了

 

mac上启动springboot项目很慢的解决方案

标签:res   上启   boot   too   cond   解析   pre   复制   本机   

原文地址:https://www.cnblogs.com/han-sun/p/12627850.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!