Micronaut vs Spring Boot

Navid Ghahremani
4 min readMay 8, 2021

This time a proper fight :)

Finally, I got the chance to look into Micronaut around a year ago (Before the pandemic); I started a project, to be more accurate, I started converting a Spring Boot application to a Micronaut application.

In the beginning, it was kind of hard to understand how the Micronaut works due to the lack of good documentation. I did a lot of research to understand a simple thing.

In case you wonder, I finally learned a lot about it from the videos below presented by the founder/developer:

Problems:

  1. Connecting to a MongoDB should be simple right? I do not want to be a person who complains all the time but honestly, why would I need to change two places in my application config for the connection info? Yeah, it gives you the ability to have multiple connections from the config file but in reality how many times you face this situation? Why should I put so many data-source-specific annotations on my model and repository classes? Wasn’t it supposed to be decoupled when you use Micronaut Data? That is the whole reason to use the repository pattern. Also, what is wrong with the way Spring Boot handles different data source connections?
  2. Then, I encountered the problem of having an AOP on the libraries that have been used, it seems the AOP is just for the code that you write at least the version I was using.
  3. To support some stuff like JPA and others which are famous for their functionalities, it seems the developers just ported them and, basically; they allow you to use libraries that do the reflection which is against of Micronaut principle.
  4. Difficulty fits with dealing with Micronaut, when I started using Mongo DB in their subproject called `micronaut-data`, I realized suddenly; they are not supporting it even though they promised it is a Microservice quality framework, lots of microservices nowadays are using No-SQL databases which clearly the developers didn’t care that much and still don’t. (See the issues raised in their Github and I mentioned it below)
  5. I had a rough time getting the answer from the developers or the support team (On their Github or Gitter) and I have the proof of that. Just check the reply dates:

Now see the response time of the Spring team:

On the other hand, Spring Boot/Data make all the above functionalities very easy to use but we know it comes with the greater cost of memory footprint, long startup time, reflections, and all of those bad boys which I frankly surprised how fast a Micronaut project was in the startup time, not so great after the boot compare to spring application especially when you use high throughput data and reactive programming. I am not going to paste performance metrics here but you can find it easily with a small search like this:

We heard enough, Let’s wrap it:

Do not get me wrong, I complained a lot about the Micronaut in this article because it was a pain for me to start, to work with, and to continue with it but it is a great project with a great future, just it is not a right time for me to use it. It might bring down the cost of service in a short time but in the long run, it costs even more, as it has so many learning curves you need to figure out it on your own and the support team is not mature enough to help you get through the problem. It still is great for small projects and small microservices that do not have that much complexity or database interaction but when it comes to deal with Kafka, Database, Batch and others, I do not recommend it.

I really do not know what their plan is.

  1. Do you think they might stop the project?
  2. Do you think they might have cold feet as Spring started rolling out the compile-time functionality the same thing Micronaut is famous for?
  3. Do you think their growth rate is fast enough to compete with such a giant framework like Spring?

I recommend it if you really have tiny Microservices and for small interaction but for a medium to big size project, still, Spring Boot/Cloud/Data is the best. I cannot convince myself yet to give it another try after a year but if you think it is beneficial and has something to offer, let me know your thoughts on the comments, my Twitter (https://twitter.com/navid_gh), or my Linkedin (https://www.linkedin.com/in/ghahramani). Share your thoughts and let’s thrive together.

Please clap if you enjoyed reading this article.

--

--