简体   繁体   English

如何在Spring Boot和@GetMapping中结束服务

[英]How to end a service in Spring boot and @GetMapping

I have developed a service REST with Spring Boot, however when I have generated the .jar and excecute it, I do not know how to finished it. 我已经用Spring Boot开发了一个服务REST,但是当我生成并执行.jar时,我不知道如何完成它。 (I do not like using Ctrl + Alt + Supr). (我不喜欢使用Ctrl + Alt + Supr)。

Does anyone know how to exit an application (of Spring Boot / REST service), for example: 有谁知道如何退出(Spring Boot / REST服务的)应用程序,例如:

@GetMapping()
public void endApplication(){
 .....End Application .....
}

Typically, the point of a service is to run indefinitely. 通常,服务的重点是无限期地运行。

However, in your example, you could implement it this way: 但是,在您的示例中,您可以通过以下方式实现它:

@GetMapping()
public void endApplication(){
    System.exit(0);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM