WINDOWS环境将SpringBoot程序注册成为服务实现开机自启和后台运行

https://www.cnblogs.com/dahuo/p/16618954.html

<?xml version="1.0" encoding="UTF-8"?>

<service>

    <!-- 服务ID -->

    <id>win-java-service-demo</id>

    <!-- 服务名称 -->

    <name>win-java-service-demo</name>

    <!-- 服务描述 -->

    <description>xxxx</description>

    <!-- jar包运行参数,指定运行程序的jdk位置 -->

    <executable>C:\Program Files\Java\jdk1.8.0_161\bin\java.exe</executable>

    <!-- -jar之后是jar包名称 -->

    <arguments>-Xrs -Xmx512m -jar win-java-service-demo.jar</arguments>

    <!-- 日志配置 -->

    <logpath>D:\java服务\log</logpath>

    <logmode>rotate</logmode>

</service>
win-java-service-demo.exe install  #安装服务

sc start win-java-service-demo     #启动服务

sc stop win-java-service-demo      #停止服务

sc delete win-java-service-demo    #删除服务

你可能感兴趣的:(spring,boot,windows,后端)