Coder Social home page Coder Social logo

spring-boot-daemon's Introduction

Build Status Coverage Status

Spring Boot Daemon

This project enables a Spring Boot application to be managed as a service on Windows.

Building

You need Maven to build the project and a simple mvn package at the root will do.

Unix

There is no need for Spring Boot Daemon on Unix thanks to the native Spring Boot support from 1.3 onwards.

Windows

The windows distribution uses winsw.

Warning
You need to install the .NET framework on the target machine first.

Installing and Running Services

To install the application as a service, extract the distribution zip somewhere and open a shell with administrative rights in that directory.

Install Service
C:\dir> install.bat

Once the service has been installed, you can start it the usual way, that is:

Start Service
C:\dir> startup.bat
Stop Service
C:\dir> shutdown.bat
Run Application from Command line
C:\dir> run.bat
View Service Status
C:\dir> status.bat

Note: A result of NonExistent means the service is not installed.

Uninstall Service
C:\dir> shutdown.bat
C:\dir> uninstall.bat

Logs

The logs are available in the logs directory of the distribution.

Usage in your application

Or, How to convert your application into a Windows Service.

To enable running your own Spring Boot applications as a Windows Service:

  1. add net.kemitix:spring-boot-daemon-integration as a dependency

  2. copy, unaltered, the assembly and dist directories from spring-boot-daemon-sample/src/main into your own application sources

  3. add the project/build/plugins section from spring-boot-daemon-sample/pom.xml to your own pom.xml, including the spring-boot-maven-plugin (needs layout=ZIP), which should be first among these plugins

  4. add the following properties and repositories to your pom.xml, updating the values to suit:

    <properties>
        <spring-boot.version>1.3.5.RELEASE</spring-boot.version>
        <start-class>net.nicoll.SampleApplication</start-class> <!--(1)-->
        <winsw.version>1.18</winsw.version>
        <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
        <maven-resources-plugin.verion>2.7</maven-resources-plugin.verion>
        <maven-assembly-plugin.version>2.6</maven-assembly-plugin.version>
        <dist.dir>${project.build.directory}/dist</dist.dir>
        <dist.service.name>${project.artifactId}</dist.service.name>
        <dist.service.display.name>Sample Spring Boot App</dist.service.display.name> <!--(2)-->
        <dist.service.description>
            Demonstrate how to integrate a Spring Boot app as a Windows Service <!--(3)-->
        </dist.service.description>
        <dist.jar>lib\${project.artifactId}-${project.version}.jar</dist.jar>
        <dist.start.class>${start-class}</dist.start.class>
        <dist.jmx.port>50201</dist.jmx.port> <!--(4)-->
    </properties>
    <repositories>
        <repository><!-- repo for downloading winsw.exe from -->
            <id>jenkins</id>
            <name>Jenkins Repository</name>
            <url>http://repo.jenkins-ci.org/releases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
  1. Your Spring Boot application class

  2. The name that shows in the Windows Services Control Panel

  3. The longer description that shows in the Windows Services Control Panel

  4. The JMX Port on the machine that will be assigned to the server, must not conflict with another usage and is required to be able to shutdown the service

spring-boot-daemon's People

Contributors

kemitix avatar snicoll avatar michael-simons avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.