spring boot 部署参考官方文档https://docs.spring.io/spring-boot/docs/2.0.8.RELEASE/reference/htmlsingle/#deployment-windows
通过官网信息可得,在windows server上部署spring boot 需要使用winsw
winsw下载地址:https://github.com/winsw/winsw/releases
仔细阅读安装指南:https://github.com/winsw/winsw/blob/master/doc/installation.md
根据安装指南,可以看出需要下载的文件包括sample-minimal.xml、WinSW.NET4.exe
把sample-minimal.xml、WinSW.NET4.exe放在同一个目录下,打包的jar也放在同一目录下,修改exe、xml文件的名称为同样的名称。
修改xml配置文件
xml文件配置参考:https://github.com/winsw/winsw/blob/master/doc/xmlConfigFile.md
在<arguments>中配置jar
如果server中配置了java,在executable直接配置java就可以了
<service>
<!-- ID of the service. It should be unique across the Windows system-->
<id>s*********l</id>
<!-- Display name of the service -->
<name>s*********l_test</name>
<!-- Service description -->
<description>This service is a service created from a minimal configuration</description>
<!-- Path to the executable, which should be started -->
<executable>java</executable>
<arguments>-Xmx256m -jar s*************y.jar</arguments>
<logmode>rotate</logmode>
</service>
管理员权限启动cmd,在exe目录中,执行exe install安装服务
输入net start xxxxxxName启动服务。或者在cmd中输入services.msc查看系统服务,手动启动服务