解决mac启动springboot项目速度慢问题

自从使用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,而后发现启动项目时并无变快。因此,必定要细心啊~~~~配置

相关文章
相关标签/搜索