Vert.x and Spring – implementing fully functional microservices eco system in under 15 minutes.

Vert.x and Spring – implementing fully functional microservices eco system in under 15 minutes.

March 7, 2017

Building Microservices was the final book covered by our company’s training program. I can strongly recommend reading it if you want to get familiar with the trendy topic of developing microservices and the different features of the architectural style itself.

At the beginning of the book the author describes a few key benefits and one of them is technology heterogeneity.

“With a system composed of multiple, collaborating services, we can decide to use different technologies inside each one. This allows us to pick the right tool for each job, rather than having to select a more standardized, one-size-fits-all approach that often ends up being the lowest common denominator.”


Reading this quote, the developer in me started to whisper “Build something… Build something”, so I was wondering how can I rapidly setup microservices eco system with technologies used in my current project.

Core advantage of being a software engineer working for a startup company in the Silicon Valley is the ability to use cutting edge technologies. Recently we adopted Vert.x – ideal framework for creating light-weight, high-performance, microservices. My idea was to use it for creating simple autonomous software unit which gives information about itself.

The other tool which I have already used and feel quite comfortable working with is Spring Boot. It will help me to quickly setup infrastructure for discovering and registering the developed microservices. Let’s start!

I will use as a reference this very useful blog post.

Step 1. Clone

Step 2. Go to complete/eureka-service folder and execute mvn spring-boot:run. This step will build and execute the discovery and registration service which is the backbone of our eco system. Open http://localhost:8761. This is the Eureka Service Registry application. For more information check

Step 3. Clone and execute again mvn spring-boot:run. Other approach is to manually create the following classes in a previously generated Spring Boot project.(

The following class starts a Spring Boot application and automatically tries to register itself to the registration service which is already running at http://localhost:8761. This is accomplished with the @EnableDiscoveryClient annotation.

The method marked with @PostConstruct is related to the Vert.x framework and later will initialize HTTP server which will handle REST requests.

For more information about what verticle is check

/src/main/java/eu/dreamix/ provides all the magic. The class initializes HTTP server which will expose REST resource at /info and will give us information about the application.

In order to disable the Spring Boot’s built-in Tomcat instance include spring.main.web-environment=false in the file.

For more information about the vert.x server and routes check


Simple configuration class which reads property values populated in


Again execute mvn spring-boot:run and open the application at the configured httpPort.(In my case it was http://localhost:8080/info).
The last thing you should check is the Eureka dashboard(http://localhost:8761) which now should show the newly registered microservice.



Boyko Dimitrov

Java Developer at Dreamix

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!