/inventory

Primary LanguageJavaMIT LicenseMIT

Inventory Microservice

This project is a sample about microservices with IBM WebSphere Liberty, as a part of the projects of IBM Mexico Team

In first instance, is a REST API to manage the products and inventory.

This project was generated by the Liberty app accelerator

Platform

Table of Contents

Summary

The Liberty App Accelerator provides a starting point for creating applications running on WebSphere Liberty.

Requirements

Configuration

The application is configured to provide various technologies and features. 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 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.

  • REST : Inside the project there is a application.rest package containing the LibertyRestEndpoint class. This adds a REST endpoint which you can access at http://localhost:9080/<context>/rest. There is also a test class named it.rest.LibertyRestEndpointTest that will test the REST endpoint to ensure it is working. For the complete feature documentation, see the jaxrs-2.0 feature description in IBM Knowledge Center.

  • Springboot : Inside the project there is a application.springboot.web package containing two classes:

    • SpringBootLibertyApplication: The entry point for the SpringBoot application.
    • LibertyHelloController: A Spring REST endpoint which you can access at http://localhost:9080/<context>/springbootweb

There is also a test class named it.springboot.web.HelloControllerTest that will test the Spring REST endpoint to ensure it is working.

  • Swagger : Swagger is a simple yet powerful representation of RESTful APIs. Discover REST APIs that are available on the Liberty server and then invoke the found REST endpoints using the Swagger user interface. (Username and password are specified in the server.xml). You can also easily expose the REST endpoints available from your web modules running on Liberty server by documenting the endpoints using the Swagger 2.0 Specification. It is also possible to follow a design-first approach by creating the Swagger documentation first and then generating the server code from it. For the complete feature documentation, see the apiDiscovery-1.0 feature description in IBM Knowledge Center.

Run

To build and run the application:

  1. mvn install
  2. mvn liberty:run-server

Endpoints

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.

Notices

This project was generated using:

  • generator-java v2.7.2
  • java-common v2.3.0
  • generator-ibm-service-enablement v0.0.97
  • generator-ibm-cloud-enablement v0.0.110
  • generator-liberty v6.0.1