/branch

Branch microservice

Primary LanguageJava

Branch microservice

Getting started

Install Java 11

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk11
which java

Instal Maven3

brew install maven
mvn --version

Install Docker Desktop for Mac and

Verify docker installation

docker -v

SpringToolSuite4/Eclipse Plugins (Optional)

http://marketplace.eclipse.org/content/eclipse-docker-tooling
To activate: Window > Show View > Other…​ (Docker Explorer)

Install Lombok

download available from: https://projectlombok.org

java -jar lombok.jar

Install pjson

Install pygments and xmlformatter

pip install pjson xmlformatter

Build and Test using Maven

  1. Run application:

    mvn spring-boot:run
  2. Test application

    curl -s localhost:8080/2 | pjson

Jib builder and run using a Docker image

  1. To create the image, Jib can use the local Docker daemon

    mvn clean package jib:dockerBuild -Dimage=examples/branch
    docker run -p 8080:8080 examples/branch
  2. Test application

    curl -s localhost:8080/search?lon=-46.739716&lat=-23.525636&radius=2000 | pjson

Spring Boot and H2 Magic

  1. H2 provides a web interface called H2 Console to see the data. Let’s enable h2 console in the application.properties.

    spring.h2.console.enabled=true

When you reload the application, you can launch up H2 Console at http://localhost:8080/h2-console.

Caution
If you are unable to see the tables…​
Usually, the table’s are created but the url used in H2 GUI Console is wrong. Change the database url to jdbc:h2:mem:testdb