Contact Us About Sponsorship

Questions about Micronaut Foundation sponsorship?

Please complete this form, and we’ll follow up with you shortly.

[hubspot type=form portal=4547412 id=a7b3ddfa-64b0-47fd-8358-45fa6a09456a]

Micronaut 2.2 Released!

by Jason Schindler Tags:

The Micronaut team is excited to announce the release of Micronaut 2.2!

The Micronaut team is excited to announce the release of Micronaut 2.2! This release features MQTT support, packaging and configuration enhancements for the Micronaut Maven Plugin, pushing a new project directly to GitHub from Micronaut Launch, a preview of R2DBC support with Micronaut Data, and a bunch of other enhancements!

MQTT

Micronaut 2.2 includes a brand new configuration for MQTT support! Similar to our existing Kafka and RabbitMQ configurations, Micronaut MQTT provides support for using annotations to publish and consume data from topics that use MQTT version 3 or 5.

Here is an example interface that will create a MQTT publisher for a topic called product:

import io.micronaut.mqtt.annotation.Topic;
import io.micronaut.mqtt.v5.annotation.MqttPublisher;

@MqttPublisher
public interface ProductClient {

    @Topic("product")
    void send(byte[] data);
}

You can build a subscriber for this topic using the @MqttSubscriber annotation:

import io.micronaut.mqtt.annotation.MqttSubscriber;
import io.micronaut.mqtt.annotation.Topic;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@MqttSubscriber
public class ProductListener {

    List<String> messageLengths = Collections.synchronizedList(new ArrayList<>());

    @Topic("product")
    public void receive(byte[] data) {
        messageLengths.add(new String(data));
        System.out.println("Java received " + data.length + " bytes from MQTT");
    }
}

For more information and configuration options, please see the Micronaut MQTT Guide!

Native Image and Docker support in Maven Plugin

The latest Micronaut Maven Plugin includes first-class support for a number of packaging options including:

  • Runnable fat Jars
  • Docker Images
  • GraalVM Native Images

To configure your project’s runtime and preferred package, you can declare the following properties:

<project>
    <packaging>${packaging}</packaging>
    <properties>
        <!-- ... -->
        <packaging>jar</packaging>
        <micronaut.runtime>netty</micronaut.runtime>
    </properties>
    <build>
        <plugins>
            <!-- ... -->
            <plugin>
                <groupId>io.micronaut.build</groupId>
                <artifactId>micronaut-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

Now, running mvn package will package your Micronaut project into a runnable jar that includes the Netty runtime!

To package your application as a GraalVM native image or a Docker image, you can set your packaging property to native-image or docker.

For a Docker image that contains a GraalVM native image, use docker-native.

mvn package -Dpackaging=native-image

For a full list of options and features, please see the Micronaut Maven Plugin documentation.

Push to GitHub

Micronaut Launch learned a new trick! Starting with version 2.2.0, you can push new Micronaut projects directly to GitHub!

First, select the options and features that you would like for your new Micronaut project. Now, when you select “Generate Project”, pick the “Push to GitHub” option:

Push to GitHub menu option

After authenticating with GitHub, your new project will be available to you as a brand new repository:

Push to GitHub result

Congratulations! Now you can git clone ... and go!

Try it out!

Create a new Micronaut 2.2 application with Micronaut Launch, or visit our Download page for other options to get started including installing the latest Micronaut CLI.

This is just a sampling of the enhancements that come with Micronaut 2.2. This release also includes JSON Feed support, Micronaut Security now supports Client Credentials Grant, and the Gradle plugin received an improvement to allow for testing with native images. For a full description of this release, please see the What’s New section of the guide.

For Micronaut Documentation, Guides, and API information see our Documentation page.

Thank You!

This release would not have been possible without the contributions and support of the amazing Micronaut community! Thank you to all that have contributed time, effort, and energy to making Micronaut a world-class framework for developing applications on the JVM.

We would also like to thank the Technical Advisory Board, Board of Directors, and Contributing Members of the Micronaut Foundation.

The Micronaut Foundation is a not-for-profit organization that exists to support and collectively lead the open source Micronaut project. To learn more about the Micronaut Foundation including how you can help support the continued growth and enhancement of the Micronaut framework, please visit the Micronaut Foundation or reach out to foundation@micronaut.io.