I using WinSW to be wrapper for Spring Boot application to run as a Windows service (following section 61.3 of Spring Boot document). There few easy step to setup.
- Download WinSW binary distribution from website https://github.com/kohsuke/winsw/releases
- Copy WinSW.exe into Spring Boot application folder (ex: my file is WinSW.Net4.exe)
- Rename your WinSW.exe to same as your jar file (for easy to remember).
- Create XML file name same as jar file. This file is using for configuration of Windows services.
- Put configuration for services wrapper in your xml file.
1 2 3 4 5 6 7 8 9
<?xml version="1.0" encoding="UTF-8"?> <service> <id>my-application-0.0.1</id> <name>my-application-0.0.1</name> <description>My Exaple Spring Boot Services</description> <executable>java</executable> <arguments>-jar -Xmx1024M -Xms128M "my-application-0.0.1.jar"</arguments> <logmode>rotate</logmode> </service>
Property Name Description id Your services id. name Your service's name that shown in Windows. description Your service's description. executable This value must be "java" arguments Your argument for run the application. logmode Your service's log mode default is rotate
- Now you can run command to install your services.
my-application-0.0.1.exe install
- If you need to uninstall services run this command.
my-application-0.0.1.exe uninstall
Comments
Post a Comment