美文网首页
解决mac启动springboot项目速度慢问题

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

作者: 码农梦醒 | 来源:发表于2018-04-20 06:32 被阅读1058次

    打开/etc/hosts文件

    原始内容大概如下:

    ##
    # 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 
    

    修改内容, 加入'你的机器名.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 你的机器名.local
    255.255.255.255     broadcasthost
    ::1                 localhost 你的机器名.local
    

    如何查看机器名

    方式一:

    屏幕快照 2018-04-20 06.23.24.png

    紫色方框内的内容就是: 你的机器名.local

    方式二:

    打开终端, 输入命令hostname

    原先运行一个最简单的springboot项目(helloword), 需要16秒(指定了logback配置文件,不指定的时候大概要11秒), 修改了hosts文件之后, 2s就可以启动了

    其它补充说明

    Visual VM在mac也会要很久才能加载出左侧的local内容, 解决方案也是修改/etc/hosts文件, 添加127.0.0.1到hostname的映射

    相关文章

      网友评论

          本文标题:解决mac启动springboot项目速度慢问题

          本文链接:https://www.haomeiwen.com/subject/rwyokftx.html