将springboot部署的jar包作为windows服务,实现开机自动启动<br/>
1、将打包好的jar包重命名,将版本号去掉 如 xxxxxx-1.0.0.jar 重命名为 xxxxxx.jar<br/>
2、将下载好的WinSW.NET4.exe文件放置xxxxxx.jar同一路径下,并将其 重命名为 xxxxxx.exe (与jar名称一致)<br/>
3、下载sample-minimal.xml至同一路径,并将其 重命名为 xxxxxx.xml (与jar名称一致)<br/>
4、xxxxxx.xml文件,修改配置如下<br/>
<configuration><br/>
<!-- ID of the service. It should be unique accross the Windows system--><br/>
<id>xxxxxx</id><br/>
<!-- Display name of the service --><br/>
<name>xxxxxx Service (powered by WinSW)</name><br/>
<!-- Service description --><br/>
<description>This service is a service cratead from a minimal configuration</description><br/>
<!-- Path to the executable, which should be started --><br/>
<executable>java</executable><br/>
<arguments>-jar "xxxxxx.jar"</arguments><br/>
<log mode="none"/><br/>
</configuration><br/>
5、至此所有配置已完成,在此目录下以管理员身份执行cmd 命令为 AllInOne.exe install,在windows服务可见我们的jar包已经被作为了windows服务。<br/>
PS: 替换新包步骤:1、将服务停止,更换新包(重命名包名) 2、启动服务<br/>
卸载服务步骤: 1、停止服务 2、管理员身份执行cmd 命令为 xxxxxx.exe uninstall<br/>
相关文件请放置固定位置,以防他人误删<br/>
重要提示 作为windows服务后启动,无法查看控制台,请将完善项目中的log输出日志文件配置。