8

I can run a Spring Boot application with a following Maven command:

mvn spring-boot:run 

but I don't know how to do a graceful shutdown of application which was started in a such way. Please advise.

alexanoid
  • 24,051
  • 54
  • 210
  • 410
  • Possible duplicate of [How to shutdown a Spring Boot Application in a correct way?](https://stackoverflow.com/questions/26547532/how-to-shutdown-a-spring-boot-application-in-a-correct-way) – Raphael Amoedo Jul 31 '17 at 21:12
  • Have you tried with Ctrl-c as per the doc here http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#getting-started-first-application-run ? If so, did you see any issues ? – Anil Kumar Athuluri Jul 31 '17 at 21:15
  • manual Ctrl-c works fine but I want to automate this process and use it from my scripts – alexanoid Jul 31 '17 at 21:19
  • @alexanoid, Refer this url https://stackoverflow.com/questions/26547532/how-to-shutdown-a-spring-boot-application-in-a-correct-way/34875139#34875139 it has couple of answers which might be helpful, – Anil Kumar Athuluri Jul 31 '17 at 21:36
  • If you want to automate don't use `mvn spring-boot:run` use an executable jar as explained in the reference guide. – M. Deinum Aug 01 '17 at 06:07

1 Answers1

13

To gracefully exit your application simply hit ctrl-c in your terminal.

Or you can use mvn spring-boot:start to start you app in background and mvn spring-boot:stop to shutdown gracefuly.

Sébastien Helbert
  • 2,185
  • 13
  • 22