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!

  • Ashish Chande

    Did you integrate Spring Oauth2 with vertx. Suppose I have spring ecosystem and only of the microservice uses vertx and I want this vertx microservice to be a resource server, how do I configure that

    • Boyko Dimitrov

      Hi Ashish,

      Thank you for your comment!

      Do you have strict requirement to use Spring OAauth2? If not, check, since the framework provides it’s own implementation for OAuth2.


  • Suhas Kadam

    HI, Very useful article. i was trying to execute this demo but there is a problem when i execute

    mvn spring-boot:run from “vertx-microservice” project. not able to listen anything on given port. can you help me out?

    • Boyko Dimitrov

      Hi Suhas,

      Thanks for pointing that out! You can pull the latest changes from the project repository with updated pom.xml file. The problem was that spring-boot maven plugin was not included in the file and this leads to the reported issue.

      Thanks again! :)

  • Black Salute

    Huge thanks for the post. Worked without glitch!

    • Boyko Dimitrov

      I am glad it is helpful! :)

  • Armen Arzumanyan

    I am trying integrate also swagger, it will be nice, but still problems, you can have a look at this

    • Boyko Dimitrov

      Hi, Armen! Sorry for the late response. I checked that you have resolved your problem with the Swagger integration! Well done

      • Armen Arzumanyan

        Thanks:) I think Vert.x + Spring cloud ready to go production. Microservices game win vertx+spring cloud

  • Vidhya Srinivasan

    I want to use vert.x as entry point,an API gateway before accessing micro service.can I use this approach to route my requests.Thanks!