An educational project to learn reactive programming with Spring 5
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper [#11] update maven wrapper Mar 26, 2018
src [#11] rename more tests acording to the surefire default rules Mar 26, 2018
.codebeatignore add codebeat ignore Jun 3, 2017
.gitignore initial commit Mar 28, 2017
.travis.yml back to jacoco May 29, 2017
LICENSE adding LICENSE Jun 4, 2017 adding LICENSE Jun 4, 2017
mvnw permission access for travis Mar 28, 2017
mvnw.cmd initial commit Mar 28, 2017
pom.xml [#11] update jacoco Mar 26, 2018

Reactive Micro Services Example

License: MIT Build Status codecov codebeat badge


This is an example of doing reactive MicroServices using spring 5 functional web framework and spring boot 2.

There is a Kotlin fork of this service.

This service provide and API that will get the geo location and the sunrise and sunset times from an address.

Scenario: Get Location
  Given I've an address
  When I call the location service
  Then I should get a geo location
  And I should get the sunrise and sunset times

To implement this example we consume a couple of REST APIs.

This example cover several topics:

  • Functional programing.
  • Reactive types.
  • Router Functions.
  • Static Web-Content.
  • Creation on Reactive Java Services/Components.
  • Error handling in routes and services.
  • Reactive Web Client to consume external REST Services.
  • Organizing your project in manageable packaging.

Includes and in depth look to testing using JUnit5:

  • Unit, Integration and System tests.
  • Mocking, including reactive functions and JSON responses.
  • BDD style assertions.
  • Test tags with maven profiles.


To run this service:

$ mvnw spring-boot:run

Sample requests

Get from address

$ curl -X GET "http://localhost:8080/api/location/Trafalgar%20Square%2C%20London%2C%20England" -H  "accept: application/json"

Post from JSON

$ curl -X POST "http://localhost:8080/api/location" -H  "accept: application/json" -H  "content-type: application/json" -d "{  \"address\": \"Trafalgar Square, London, England\"}"

Both will produce something like:

  "geographicCoordinates": {
    "latitude": 51.508039,
    "longitude": -0.128069
  "sunriseSunset": {
    "sunrise": "2017-05-21T03:59:08+00:00",
    "sunset": "2017-05-21T19:55:11+00:00"

All date and times are ISO 8601 UTC without summer time adjustment


View in the embedded Swagger UI View in the embedded Swagger UI

Run in Postman Run in Postman

Project Structure