I don't have any other issues with java and STS starts up fine but when I try to run my app as "Run as Spring Boot App"
(or any of the samples), the console is empty for up to 5 minutes, before I get the familiar "Spring Boot" ASCII art. Then it works fine.
Asked
Active
Viewed 5,783 times
23

Brock Adams
- 90,639
- 22
- 233
- 295

Paul Drummond
- 6,043
- 6
- 30
- 38
-
Wow that's bad. What if you run them from the command line? Is it any better the second time (after Maven dependencies are cached)? – Dave Syer May 08 '14 at 21:06
-
Happened to me too after Sierra upgrade. – Shai M. Jan 29 '17 at 07:34
2 Answers
78
Turns out there was an issue resolving the network host. I fixed it by executing this command from the console:
scutil --set HostName "localhost"

Paul Drummond
- 6,043
- 6
- 30
- 38
-
3Wow, applying this fix took my spring-boot startup down from 60 seconds to < 3, it was driving me mad! – djhworld Nov 08 '15 at 22:21
-
3
-
-
1Great! Could you point out the difference between setting a "real" name vs. using "localhost"? – Steve Oh Jan 26 '17 at 13:54
-
Same... Wow.... I wonder if Springboot could add a check for this issue. Any idea why this slows it down so much? – Michael Haefele Feb 03 '17 at 17:16
-
1Paul, please, how can you find out this solution? Very good. The startup time down 60 seconds to 5 seconds. Thanks! – Silvio Lucas Apr 29 '17 at 21:16
-
-
Worked like a charm on Mojave. I don't know why this issue persists for such a long time. – Duc Le Jun 04 '19 at 09:14
-
1This works also in MacOS Catalina. I've also added it to the .bash_profile so it's always set from start. – Filipe Melo Mar 11 '20 at 14:40
-
Confirm working on Big Sur `11.5.1 (20G80)`. Startup time reduced from `16` seconds to `1` second. – blackr1234 Aug 16 '21 at 05:03
0
It must be something with you environment. You may try running the app in other IDE like Intellij. I presume it's the STS causing the problem. You may also try running it in fresh STS installation. I'm using latest OSX and Intellij and have no problems.
If you want to play around with this you could also analyse a java code dump to see what's happening inside your jvm: http://www.javacodegeeks.com/2013/02/analysing-a-java-core-dump.html

kazuar
- 1,094
- 1
- 12
- 14
-
You might not need a core dump. A simple thread dump (from kill -3, or jstack) would probably tell you a lot. – Dave Syer May 08 '14 at 22:53