Sample REST program
We will use a simple approach to building a standalone application. It packages everything into a single executable JAR file, driven by a main()
method. Along the way, you use Spring's support for embedding the Jetty servlet container as the HTTP runtime, instead of deploying it to an external instance. Therefore, we would create the executable JAR file in place of the war that needs to be deployed on external web servers, which is a part of the rest
module. We'll define the domain models in the lib
module and API related classes in the rest
module.
The following are pom.xml
of the lib
and rest
modules.
The pom.xml
file of the lib
module:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> ...