Gradle > How to stop a Spring Boot application launched with gradle bootRun?
Asked Answered
E

2

25

I started a spring boot application using gradle bootRun.

Doing ctrl-c in the terminal where I launched the command does not stop the application.

What is then the correct way of stopping it?

Engaging answered 21/11, 2018 at 19:29 Comment(7)
Have you seen baeldung.com/spring-boot-shutdown ?Sought
@ThiagoChagas it does not answer my question. I'll rephrase it. I want to know how to kill the spring boot application launched with the command gradle bootRun as doing ctrl-c on the commnad line does not seem to stop it.Engaging
You can check the process using netstat and then kill the process on that port.Watermelon
Yes but I was expecting it to stop. So I'd like to know if it is normal or not for the process not to stop.Engaging
Hit Ctrl + C few more times? Try Ctrl + D? Are you using Gradle Daemon? Try to disable it (--no-daemon)?Marianomaribel
@Marianomaribel I am using the gradle daeomn but why should I disable it?Engaging
It was just a guessMarianomaribel
U
17

You can use the command gradle -stop to stop the Spring Boot application.

Untouched answered 18/8, 2019 at 3:6 Comment(2)
I tried ./gradlew -stop and it worked for me. Thanks a lot!Devries
This is killing the gradle demons, which is not right, there should be better way to stop spring boot servers gracefully without exceptions thrown.. do any know pl. sharePardon
L
4

Not sure what operating system you are using but I am on a mac and was having the same problem, command + C wasn't working (on a mac the command key is equal to the Windows control key) but I used control+C and it did work. If you're on a Windows machine this doesn't help you but thought this might help others who are new to a mac.

Locklear answered 2/10, 2019 at 0:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.