Microservice
IBM Cloud Microservice Starter for Java - MicroProfile / Java EE
Table of Contents
Summary
The IBM Cloud Microservice Starter for Java - MicroProfile / Java EE provides a starting point for creating Java microservice applications running on WebSphere Liberty.
Requirements
- Maven
- Java 8: Any compliant JVM should work.
- Java 8 JDK from Oracle
- Java 8 JDK from IBM (AIX, Linux, z/OS, IBM i), or Download a Liberty server package that contains the IBM JDK (Windows, Linux)
Configuration
The application is configured to provide JAX-RS REST capabilities, JNDI, JSON parsing and Contexts and Dependency Injection (CDI).
These capabilities are provided through dependencies in the pom.xml file and Liberty features enabled in the server config file found in src/main/liberty/config/server.xml
.
Project contents
The microservice application has a health endpoint which is accessible at <host>:<port>/[PROJ_NAME_PLACEHOLDER]/health
. The context root is set in the src/main/webapp/WEB-INF/ibm-web-ext.xml
file. The ports are set in the pom.xml file and exposed to the CLI in the cli-config.yml file.
Credentials are either taken from the VCAP_SERVICES environment variable that IBM Cloud provides or from environment variables passed in by JNDI (see the server config file src/main/liberty/config/server.xml
).
Run
To build and run the application:
mvn install
mvn liberty:run-server
To run the application in Docker use the Docker file called Dockerfile
. If you do not want to install Maven locally you can use Dockerfile-tools
to build a container with Maven installed.
Endpoints
The application exposes the following endpoints:
- Health endpoint:
<host>:<port>/<contextRoot>/health
The context root is set in the src/main/webapp/WEB-INF/ibm-web-ext.xml
file. The ports are set in the pom.xml file and exposed to the CLI in the cli-config.yml file.
Notices
This project was generated using:
- generator-ibm-java v5.14.1
- generator-ibm-service-enablement v3.2.1
- generator-ibm-cloud-enablement v1.7.7
- generator-ibm-java-liberty v