Skip to content

Repository files navigation

Spring Cloud Microservices

Java CI with Maven

Cloud-native sample application using microservices architecture powered by Spring Cloud.

Table of Contents

Architecture

Microservice architectural style is an approach to developing a single application as a suite of small services. In this example the technology stack used is provided by Spring Cloud, in particular:

  • Spring Cloud Release Trains - Greenwich.RELEASE
  • Spring Cloud Config - Centralized external configuration management
  • Spring Cloud Security - Provides support for load-balanced OAuth2 rest client
  • Spring Cloud Netflix - Service Discovery, Circuit Breaker and Client Side Load Balancer with Ribbon
  • Spring Cloud Gateway - Provide a simple way to route to APIs
  • Spring Cloud OpenFeign - Provides integrations for Spring Boot apps through autoconfiguration

Prerequisites

  • JDK 8 - Install JDK 1.8 version
  • Maven - Download latest version
  • Docker Toolbox - Install Docker Toolbox on your machine

Running Instructions

$ mvn clean install
$ docker-compose up --build -d

Usage

Get a token:

$ curl -X POST -vu acme:acmesecret http://localhost:9999/uaa/oauth/token -H "Accept: application/json" -d "password=admin&username=admin&grant_type=password&client_secret=acmesecret&client_id=acme"

Employee service:

$ curl http://localhost:8082/<METHOD> -H "Authorization: Bearer <YOUR TOKEN>"

Employee service (Gataway):

$ curl http://localhost:9000/employee/<METHOD> -H "Authorization: Bearer <YOUR TOKEN>"

Rest API

Employee Rest API

Method URI Description Parameters
GET /employee/
GET /employee/{id}
GET /employee/department/{departmentId}
GET /employee/organization/{organizationId}
POST /employee/

Organization Rest API

Method URI Description Parameters
GET /organization/
GET /organization/{id}
GET /organization/{id}/with-departments
GET /organization/{id}/with-departments-and-employees
GET /organization/{id}/with-employees
POST /organization/

Department Rest API

Method URI Description Parameters
GET /department/
GET /department/{id}
GET /department/organization/{organizationId}
GET /department/organization/{organizationId}/with-employees
POST /department/

About

Sample Microservices Application powered by Spring Cloud

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages