Micronaut
Published in
3 min readAug 8, 2020
Ahead-of-Time Compilation ( simple and fast )
Micronaut is a JVM based framework for building
- Lightweight Modular and easily testable application
- Fast startup and low memory consumption Microservice
- Serverless Functions
- Command line application
- Android application
It was developed by same team who developed Grails, which become open source under Apache on 23 May 2018.
Features
- Optimise start-up time
- Reduce memory footprint
- Not bound to the size of your codebase.
- Build AOP proxies at compile time that are completely reflection free, which improves performances
- Reduces stack trace sizes and reduces memory consumption.
- Micronaut functions can be deployed to either AWS lambda or any FaaS platform that can execute the function as a container.
- Designed with Microservice and cloud computing in mind
Supports
- Java, Kotlin, and Groovy development
- Maven and Gradle as build tools.
- Can run on GraalVM, JVM
- Non blocking reactive HTTP client and server API’s
- Security using JWT and OAuth2
- Service discovery eg. Eureka, Consul
- API versioning via a dedicated @ Version
- Micronaut for Spring
Micronaut vs Spring
Reactive HTTP client and server (based on Netty). adds the ability to use Spring annotation-based programming model to build Micronaut applications
- Compile-time AOP and dependency injection
- Distributed tracing and logging eg. Zipkin, Jaeger
- Scalability and load balancing
- API documentation using OpenAPI
- It is resilient - built-in support for retry, circuit breaker and fallbacks
- Builds its dependency injection data at compile time, which, of course, is much faster than reflection-based runtime dependency injection. It uses JSR-330 (java.inject) for doing it.
- Suits cloud-native features.
- Built-in support for generating Open API / Swagger YAML documentation at compilation time
Startup Time
First Response Time
Micronaut CLI
mn create-app hello-world-app -build gradlemn create-controller -lang kotlin accountmn create-app my-demo-app — features mongo-reactivemn profile-info service
Conclusion
Micronaut framework provides the ability to develop simple and fast applications, especially in the serverless environment.
Links
https://micronaut.io/blog/2020-04-28-performance-comparison-spring-boot-micronaut.html