Spring Boot vs Ballerina: Hello-World Service

Shafreen Anfar
Ballerina Swan Lake Tech Blog
3 min readNov 23, 2019


Both Spring Boot and Ballerina are very good for writing microservices. I know a lot about Ballerina but very little about Spring Boot. Hence, thought of playing a bit with Spring Boot while comparing each other. I will be starting with the very basic hello-world and then gradually moving on to more complex ones such as writing a gateway service, deploying in Kubernetes, adding resiliency, adding security, enabling observerbility, etc.

The intention of this blog-post series is not to figure out which one is better over the other but to learn about both technologies.

In this blog post, I will be comparing hello-world services written in both technologies.

Hello-World Comparison

Following are few things I managed to gather after writing a simple hello-world service in each technology. This hello-world service handles inbound HTTP GET requests with one query param. Also, for each request it maintains a count, increment it and send it back as the ID of the response. The response is a simple JSON payload.

Sample request — http://localhost:8080/hello/greeting?name=shafreen

Sample response — {“id”:1,”content”:”Hello, shafreen!”}

A quick comparison of both hell-world services

Experience with each technology

Your experienced is colored by the technologies you use for a particular task. In this case, following are the sub-technologies related to Spring Boot and Ballerina.

Associated sub-technologies

One noticeable thing is, in Ballerina you could actually feel that you are dealing with a network-distributed-application. Ballerina makes the developer aware of possible security threats, network failures and network communications while writing the program itself. Thanks to its taint checking, error handling and diagram features.

Part of the generated picuture

Look and feel of each program

Following is the aforementioned hello-world service written in Spring Boot and Ballerina. Please note that I have used IntelliJ IDEA for Spring Boot and VSCode for Ballerina.

Look and feel of each hello-world service

Three variants of the Ballerina hello-world service can be found here.


Well, this is just Hello-World comparison which gives us some sense about each technology and what to expect in the coming blog posts. As I mentioned earlier, the purpose of this blog is not to find out which one is better over the other but to learn both technologies. In the next blog post I will be writing a simple gateway service and then doing a load test against it.