SpringBoot项目启动超级慢的问题

换了新的m1芯片的Macboot pro,配置环境如下:

MacBook Pro (13-inch, M1, 2020)
芯片:Apple M1
系统版本:macOS Big Sur
jdk:
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)

然后启动springboot项目特别慢,我起初以为是idea和m1芯片的兼容问题,于是下载了针对m1芯片的idea版本,发现启动还是慢。
仔细看了下启动日志,发现了这么一行:

InetAddress.getLocalHost().getHostName() took 5008 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).

惊呆了,InetAddress.getLocalHost().getHostName() 这一句都能耗时超过5秒,于是执行下面的操作:

1. 在命令行执行hostname,得到主机名
2. sudo vim /etc/hosts 加入 127.0.0.1 yourhostname

再次启动,发现没问题了。问题解决!
继续去stackoverflow搜了一下,发现原来很多人都碰到了这个问题,提问都这个哥们这一句花了30秒,更吓人。地址在这里:
https://stackoverflow.com/questions/33289695/inetaddress-getlocalhost-slow-to-run-30-seconds


在这里差一条Git的问题:
gitee里的仓库配置了sshkey之后,执行 ssh -T "git@gitee.com" 通过了,但是无法push代码,提示错误:

remote: You do not have permission push to this repository
fatal: unable to access 'https://gitee.com/xxx/xx.git/': The requested URL returned error: 403

ssh -T 都通过了,提示我没有权限,Git config 设置的也没问题,查了一通没解决,算了,弹窗让我我自己输入用户名密码吧。
执行如下命令,可以使得push代码的时候提示输入用户名密码:

git config --system --unset credential.helper
posted @ 2021-03-30 20:26  逃离沙漠  阅读(4661)  评论(0编辑  收藏  举报