Spring Boot vs Micronaut — The battle unleashed

WalkingTree Technologies
6 min readSep 20, 2018

--

As we watch recent architecture trends in the enterprise app development area, we observe that Microservices became the de facto architecture standard. At the same time, Spring Boot became the most popular and widely used framework to implement Microservices in the Java area. For years, Spring Boot earned and retained its top position in terms of the number of implementations for Microservices. Recently OCI (https://objectcomputing.com) came up with a Micronaut framework with the prime goal of simplifying Microservices development life-cycle.

To know more about the Micronaut you can refer to our previous article: Micronaut — The potential poster boy for Microservices.

It is an interesting subject to know the detailed comparison between an old guard (Spring Boot) and new blood (Micronaut). As part of this article, I will be covering certain important attributes for Microservices and provide the comparative analysis between these two frameworks.

1. Ease of Installation

Both frameworks have the Command Line tools to get started with development quickly, we can install the related Command Line tools and create the sample Spring Boot/Micronaut application and test it.

We can also install the Spring Boot or Micronaut by using the SDKMAN, we can maintain the different versions of the SDK with SDKMAN.

Both frameworks need below prerequisites:

  • A favourite text editor or IDE
  • JDK 1.8 or later
  • Gradle or Maven latest versions

Code which has been generated through the CLI tool can be directly imported into your IDE:

  • Spring Tool Suite (STS) — Spring Boot
  • IntelliJ IDEA — Spring Boot & Micronaut

“Both Spring Boot and Micronaut won’t be complex for installation, can be installed easily by following the installation instructions, so here it’s a close competition.”

2. Natively Cloud Enabled

Here Micronaut has got the advantage because the most popular cloud features are supported by default without depending on any third party cloud services. These features will be part of the application itself.

Micronaut’s slogan is ‘Natively cloud-native app development’.

The following list of Cloud-specific features are directly integrated into the Micronaut runtime:

  • Service discovery:
  • Eureka, Consul or ZooKeeper service discovery servers are being supported
  • Kubernetes container runtime is supported by default.
  • Client side load balancing:
  • Netflix Ribbon can be used for load balancing
  • Distributed Configuration
  • Distributed Tracing
  • Serverless functions

“When it comes to Spring Boot, to support above discussed Cloud-specific features, we need to depend on the third party cloud services or libraries, it doesn’t support any of the above-listed features by default, so Micronaut has an advantage here.”

3. Serverless Functions

Serverless architecture, where Developers will deploy the function. From there onwards they are completely managed by the Cloud environment i.e. invocation, execution, control and put down.

But Micronaut’s fast startup time, compile-time approach and low-memory footprint make this framework a great candidate for developing functions and in fact, Micronaut features have the dedicated support for implementing and deploying functions to the AWS Lambda and any FaaS system that supports running functions as containers.

“Whereas Spring Boot application memory usage and startup time are little higher when we compare with Micronaut, so Micronaut will be encouraged to choose for Serverless functions implementation.

4. Language Support

Both frameworks support the three programming languages:

  • Java
  • Groovy
  • Kotlin

5. Application Configurations

Micronaut inspired from both Grails and Spring Boot in integrating configurations properties from different sources directly into the core IoC container. Configurations can be provided by default in either YAML, JSON, Java properties or Groovy files. The convention is to search for a file called application.yml, application.properties, application.json or application.groovy.

Just like Grails and Spring, Micronaut also allows overriding any property via system properties or environment variables.

Micronaut by default has the implementations of PropertySourceLoader those will load the properties from the specified locations and their sequence:

  • Command line arguments
  • Properties from SPRING_APPLICATION_JSON (Only if there is any Spring dependency)
  • Properties from MICRONAUT_APPLICATION_JSON
  • Java System Properties
  • OS environment variables
  • Each Environment-specific properties like application-{environment}.{extension} (could be .properties, .json, .yml or .groovy)
  • Application-specific properties from the application.{extension} (could be.properties, .json, .yml or .groovy)
  • Special properties ( Random Values )

Spring Boot supports above all property locations, in addition to above, it also supports other property locations:

  • Spring Boot devtools global settings properties
  • @TestPropertySource annotations on your tests.
  • @SpringBootTest#properties annotation attribute on your tests.
  • ServletConfig init parameters.
  • ServletContext init parameters.
  • JNDI attributes from java:comp/env.
  • @PropertySource annotations on your @Configuration classes.
  • Default properties (specified by setting SpringApplication.setDefaultProperties).

“Spring Boot provided more ways to handle with properties when we compared it against Micronaut.”

6. Messaging Systems support

Spring Boot supports the integration of external Messaging systems, they are:

  • RabbitMQ
  • Apache Kafka
  • ActiveMQ
  • Artemis

Micronaut also supports the popular messaging systems, such as:

  • RabbitMQ
  • Apache Kafka

“Micronaut has the embedded support for the Apache Kafka.“

“Both frameworks have the support of the popular Messaging systems but Spring Boot supports more tools.”

7. Security

Spring Boot supports below security mechanisms by default:

  • MVC Security
  • WebFlux Security
  • OAuth2
  • Actuator Security

Micronaut supports below security mechanisms by default:

  • Authentication Providers
  • Security Rules
  • IP Pattern Rule
  • Secured Annotation
  • Intercept URL Map
  • Built-In Endpoints Security
  • Authentication Strategies
  • Basic Auth
  • Session Authentication
  • JSON Web Token
  • Built-In Security Controllers
  • Retrieve the Authenticated User
  • Security Events

“Both frameworks have the different security mechanism and each one has got its own advantages, so I am neutral in this case.”

8. Logging

Both Spring Boot and Micronaut supports the similar logging, they are:

  • Logback
  • Log4j

9. Caching

Spring Boot supports following caching providers:

  • Redis
  • Couchbase
  • Generic
  • JCache (JSR-107)
  • EhCache 2.x
  • Hazelcast
  • Infinispan
  • Caffeine

Whereas Micronaut supports following list of caching providers:

  • Caffeine — by default Micronaut supports it.
  • Redis

“Obviously, Spring Boot is leading in supporting caching providers”

10. Management & Monitoring

Micronaut inspired from the Grails, Spring Boot and Micronauts management dependency add support to monitor your applications via endpoints, the special URIs that returns details about the state of your application and health.

  • Creating Endpoints
  • Built-In Endpoints

But Spring Boot supports management and Monitoring of the applications not only with Endpoints, but there are also few more ways:

  • Monitoring & Management over HTTP
  • Customizing the Management Endpoints paths
  • Customizing the Management Server Port
  • Configuring Management-specific SSL
  • Customizing the Management Server Address
  • Disabling HTTP Endpoints
  • Monitoring & Management over JMS

“Spring Boot provides additional options to monitor the application when compared with Micronaut.”

Summary

As a part of this article, We comprehensively compared different features of Micronaut and Spring Boot frameworks. At outset, Spring Boot is still leading in many aspects with the support of vast experience it acquired in handling Microservices over the years. But Micronaut( Young chap) is promising and promising enough to give tough competition to Spring Boot.

I hope this comparison helps you to take better and informed decision while deciding the Microservices development framework.

Follow us on :
https://www.facebook.com/walkingtreetech/
https://www.linkedin.com/company/walking-tree-Technologies
https://twitter.com/walkingtreetech
https://www.youtube.com/channel/UCH5y9upqT2M7uWwgRWjCWBg

We wrote some article on Microservices earlier, you can refer to them for better understanding on Microservices.

At Walking Tree, we are excited about the possibilities that Microservices ecosystem brings in. Stay tuned for more articles on this topic.

Source: https://walkingtree.tech/spring-boot-vs-micronaut-the-battle-unleashed/

--

--

WalkingTree Technologies
WalkingTree Technologies

Written by WalkingTree Technologies

WalkingTree is an IT software and service provider recognized for its passion for technology.

Responses (7)