Start any Spring Boot App as a Windows Service with AlwaysUp

How to Start Spring Boot in the Background as a Windows Service

Automatically launch your Spring Boot/Maven/Java application when your computer reboots — no need to log in first!

Spring Boot is an open source Java-based framework ideally suited for creating production-grade micro services.

To set up your Spring Boot app to start as a Windows Service with AlwaysUp:

  1. First, get the full command line you use to start your application.

    Since we followed the Spring Quickstart guide to generate the application used in this tutorial, our Maven command line is:

    C:\Maven\bin\mvn.cmd spring-boot:run

    Now would be a good time to open a command prompt and ensure that the command launches your application as you expect. If your command doesn't work here, it won't work as a service either!

  2. Download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. On the General tab:

    • In the Application field, enter the full path to the Maven executable, mvn.cmd. This is C:\Maven\bin\mvn.cmd for us.

    • In the Arguments field, enter the parameters to Maven.

    • In the Start in directory field, enter the folder holding the Spring Boot project files (where the "pom.xml" configuration file lives).

    • And in the Name field, enter the name that you would like call this application in AlwaysUp.

      We've gone with "Spring Boot Service" but you can choose a name more descriptive of your situation.

    Spring Boot Windows Service: General Tab

  6. Click over to the Logon tab and enter the user name and password of the Windows account in which you installed and configured Maven and Java. Your service needs to run in this account, to find your environment variables and other required settings (e.g. JAVA_HOME and MAVEN_HOME).

    Spring Boot Windows Service: Logon Tab

  7. Click over to the Startup tab and check the Ensure that the Windows Networking components have started box. This informs AlwaysUp that Spring Boot needs the TCP/IP networking stack to do its work.

    Spring Boot Windows Service: Startup Tab

  8. When Spring Boot is running as a background Windows Service (in the isolated Session 0), the informative console window will not be visible on your desktop. You won't be able to see if Maven or Java is failing.

    To get around that issue, we recommend capturing the console output to a text file. You can then open the file in Notepad — or better yet, use the free Tail for Win32 utility to follow the file's contents.

    To set this up, switch to the Extras tab and enter the full path to a log file in the Capture output to this log file section. We recommend automatically trimming the file to prevent it growing too large (with the checkbox below).

    Spring Boot Windows Service: Extras Tab

  9. We're now done configuring AlwaysUp, so click the Save button. In a couple of seconds, an application called Spring Boot Service (or whatever you called it) will show up in the AlwaysUp window. It is not yet running though and the state will be Stopped:

    Spring Boot Windows Service: Created

  10. To start Spring Boot, choose Application > Start "Spring Boot Service". The state should transition to Running after a few seconds:

    Spring Boot Windows Service: Running

  11. Finally, confirm that your web application is working as expected. Check both the browser and the console log file you configured in step 8.

    Our simple service is working fine:

    Confirm Spring Boot is Working

  12. That's it! Next time your computer boots, your Spring Boot application will be launched immediately, before anyone logs on.

    Feel free to edit the entry in AlwaysUp and explore the advanced options. For example, setup a "sanity check" to monitor the HTTP port for failures, send email if the service dies, and much more.



Spring Boot Application not working properly as a Windows Service?

  • Consult the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running an application as a windows service.

  • From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction between AlwaysUp and Spring Boot/Maven/Java. The AlwaysUp Event Log Messages page explains the messages that may appear.

  • Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.

  • Contact us and we will be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 12.0

5.0 MB Installer
  • Unrestricted 30-day trial for new users; upgrade for existing users
  • For Windows 10/8 and Windows Server 2019/2016/2012
  • How to Install | EULA
Our customers include...


Compatible with Windows 10 (32 & 64-bit)

Windows Server 2012 Certified (32 & 64-bit)

Windows 8 Compatible (32 & 64-bit)




Over 83,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 15+ years!