A lightweight micro-service template for publishing a REST API in a single-JAR capsule embedding the Undertow Web server.

Creation

You need to have Apache Maven 3.1+ installed. To create a REST micro-service project from scratch, run the following command:

mvn org.seedstack:seedstack-maven-plugin:generate -Dtype=rest

This will invoke the generate goal of the SeedStack maven plugin generate goal which will:

The process is interactive and will ask you a few questions about the project to be created.

Result

After execution, a single module project is created:

- myapp
    |- src
        |- main
        |   |- java
        |   |   |- org.myorg.myapp
        |   |       |- [application]    <-- application logic
        |   |       |- [domain]
        |   |       |   |- [model]      <-- domain model
        |   |       |   |- [services]   <-- domain services
        |   |       |- [infrastructure] <-- technical infrastructure
        |   |       |- rest             <-- REST resources and representations
        |   |- resources
        |       |- META-INF
        |           |- configuration    <-- main configuration
        |- test
            |- java
            |- resources
                |- META-INF
                    |- configuration    <-- test configuration

Note that the directory in brackets are not created by the archetype. They are the recommended locations if you need to add any business domain to your project. You can also choose to put the domain in a separate domain module.

Conversion to WAR

This project is designed to be run from the command-line with its embedded Web server. To convert it to a classic WAR, see this guide.

More resources