Get started

Install Java development environment

  • Install Git, details can refer to Git Installing Guide.

  • Install JDK 1.8, details can refer to JDK Installing Guide.

  • Install Maven 3.x, details can refer to Maven Installing Guide.

  • Download ServiceComb-Samples.

     git clone
     cd servicecomb-samples/java-chassis-samples/bmi
     mvn clean install

Run Service Center

Service Center enables capabilities of service registration and service discovery in ServiceComb. It can run inside docker.

docker pull servicecomb/service-center
docker run -d -p 30100:30100 servicecomb/service-center:latest

Reference to Install of ServiceCenter to learn deploying Service Center as a local binary.

Create your first microservice application

Let's start the journey of microservice with a simple Body Mass Index(BMI) application. The BMI is an attempt to quantify the amount of tissue mass in an individual. This application contains two separate microservices:

  • BMI calculator service:A microservice provides calculation of BMI.

  • Web service:A microservice provides both user interface and gateway service.

The workflow of the application is shown as follows:
workflow of BMI

Note that the dotted lines indicate the process of service registration and discovery.

Run microservice application

  1. Enter BMI codes directory.

    cd servicecomb-samples/java-chassis-samples/bmi

    Note: In windows development environment, the docker runs inside the virtual machine. The IP address of Service Center needs to be modified as the virtual machine's IP address. Modify the 2 configuration files [calculator|webapp]/src/main/resources/microservice.yaml, changed to , where is the virtual machine's IP address.

  2. Run microservices.

    cd calculator; mvn spring-boot:run
    cd webapp; mvn spring-boot:run
  3. Verify the application. Visit http://localhost:8889 in browser. Then input your height and weight to verify.

    BMI user interface

What’s next