DaeYoung
DaeYoung

Reputation: 1229

Is there elegant way to terminate running instance of spring boot stand alone application?

I've been playing with spring boot version 1.5.8 release lately. I was able to stand it up as rest web service to handle incoming request.

This is how I activate the service. Note: linux environment.

nohup java -jar fooservice.jar &

Then I tail the nohup.outfile to monitor the start up process, any incoming request, any exception thrown and etc.

My question is how to terminate the instance of the program? I run ps -ef | grep command to find pid of the running instance then run kill -9 command to terminate it.

Is there elegant way to stop the service?

Upvotes: 0

Views: 337

Answers (1)

Ryuzaki L
Ryuzaki L

Reputation: 40048

You can shutdown spring boot application by enabling actuator shutdown end point /actuator/shutdown, first we need to enable it here

management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true

And then invoke it

localhost:port/actuator/shutdown

Upvotes: 1

Related Questions