[SpringBoot/JavaEE]SpringBoot启动与停用的4种方式

SpringBoot版本: 2.1.6.RELEASE

1 启动

方式1 – IntelliJ IDEA - Windows

右键启动类SpringBootSampleApplication.java > Run “SpringBootSampleApplication#main()”

方式2 – Maven – Windows

E:
cd E:\Projects\SpringBootSample
mvn clean
mvn spring-boot:run (非后台运行)
    或 mvn spring-boot:run > ./Applog.log & (后台运行)

方式3 – Maven/JAR – AnyPlatform [推荐]

思路:mvn install编译生成出项目的jar,然后运行jar

方式4 - Maven/Linux Shell - Linux [未亲测]

请参见: 正确、安全地停止SpringBoot应用服务: 部署为Unix/Linux Service -博客园

2 停用

方式1 – 命令行 – AnyPlatform

方式2 – IDEA – Windows

方式3 – actuator – AnyPlatform [推荐]

利用端点管理器actuator,实现远程管理。
Actuator内容详见本文:端点管理actuator

方式4 - Maven/Linux Shell - Linux [未亲测]

请参见: 正确、安全地停止SpringBoot应用服务: 部署为Unix/Linux Service -博客园

3 延申

nohup

nohup 英文全称 no hang up(不挂起),用于在【系统后台】不挂断地运行命令,【退出终端】不会影响程序的运行。
nohup 命令,在默认情况下(非重定向时),会输出一个名叫 nohup.out 的文件到【当前目录】下。如果【当前目录】的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中

X 推荐文献

posted @ 2020-08-20 14:07  千千寰宇  阅读(1135)  评论(0编辑  收藏  举报