Micronaut takes small step with 2.0 release, big one for Java on serverless

The team behind Micronaut, a framework for building JVM applications in Java, Kotlin, or Groovy, has completed version 2.0 of the project, providing users with better support for serverless, a new CLI, and a browser-based launch tool.

Micronaut is an APL 2.0 licensed open source project from the creators of the Grails web application framework, and was introduced to the public in 2018. One of the major goals of the Micronaut creators was offering help in building easily testable apps, which they tackled by making aspect oriented programming, defaults and auto-configuration, dependency injection, and inversion of control central to the project. 

Microservice development was another focal point, which is why Micronaut comes with support for client-side load balancing, HTTP routing, service discovery, and distributed configuration. However, tools like Spring Boot offer heavy competition, which is why Micronaut lures developers with a shorter startup time, minimal use of proxies and reflection, little memory usage, and no runtime bytecode generation. This is achieved by pre-computing the framework infrastructure at compilation time, meaning there’s less to do at runtime for the application to work. 

For its second major release, the Micronaut team put a lot of thought into their command line interface, which has been completely rewritten in the last couple of months. The original CLI started as a simple fork of the Grails CLI, but since Micronaut isn’t restricted to Groovy and therefore needs to be able to handle more tool/language combinations, it became hard to maintain over time. The new iteration is built on the picocli project with native images for Linux, MacOS, and Windows available thanks to GraalVM Native Image.


Though the rewritten CLI is supposed to work as usual, it comes with the added benefit of being operable offline, and a couple of new features such as the capability to display “a diff of the changes required to add a new feature to an existing application”. Developers who feel more at home in the browser meanwhile don’t have to install the CLI anymore, since the team also introduced the option to build apps via web-based Micronaut Launch.

In order to make better use of the already mentioned GraalVM, the Micronaut team has stabilised support for GraalVM Native Image which now for example includes automatic detection for static resources and allows for easier database integration. 

HTTP features were another point of improvement. Operations are by default executed in the EventLoop, though users have a new annotation available to specify if an operation needs to be run on a specific executor. Micronaut is now also able to work with HTTP/2 and comes with a new EventLoopGroup to reduce context switching and use resources more effectively.

General improvements include the support of JDK 8, and Groovy 3, as well as reduced startup time. Developers are also meant to have an easier time defining bean introspections and manipulating how a bean is created. Other than that, Micronaut learned to work with new deployment targets, so that users can let their functions run on the whole gamut of main cloud providers (Google Cloud Function, Azure Functions, and AWS), and to support the creation of servlets. It also comes with a number of security improvements, all of which can be found in the 2.0 documentation.

- Advertisement -