1.1 What’s New?

Micronaut 2.3.0 includes the following changes:

Core Features

Banner

A new customizable banner is now displayed when the application starts up. See Micronaut Banner for more information.

Compatibility with GraalVM 21.0.0

This release is compatible with the latest GraalVM 21.0.0 release, updating and testing all modules against the latest version of native image.

Improved Support for Records

Java 14+ Records can now be used to define Configuration Properties. By default when @ConfigurationProperties is used on a record, configuration injection is applied. For example:

  1. package example;
  2. import io.micronaut.context.annotation.*;
  3. import javax.validation.constraints.*;
  4. @ConfigurationProperties("example")
  5. record Example(@Min(20) int num, String name) {
  6. }

Bean Introspections Now Support Execution Handles

A BeanIntrospection can now declare methods that should generate reflection free execution handles. This feature allows calling other methods (besides setters) on introspections without using reflection.

Improved Support for Copy Constructors and Immutable Types

An immutable BeanIntrospection (like Java Records as mentioned above) requires different handling when you need to create a new instance with a particular property modified. A typical pattern for this is to construct a new instance passing all the existing values plus the modified value (see for example Lombok’s @With).

Micronaut’s Bean Introspections now support this pattern. For example:

  1. val introspection = BeanIntrospection.getIntrospection(Example.java);
  2. Example example = introspection.instantiate(10, "Test");
  3. assertEquals(10, example.num());
  4. example = introspection.getRequiredProperty("num", int.class)
  5. .withValue(example, 20);
  6. assertEquals(20, example.num());

The new withValue method will automatically create a new instance populating the existing properties and returning the instance.

Micronaut will at compilation time compute an efficient copy-constructor approach that will only return a new instance if the value changes.

HTTP Features

Locale Resolution

A new interface HttpLocaleResolver has been introduced to support resolving a locale from a given request in multiple ways. A java.util.Locale object can now be a parameter to controller and client methods to automatically bind the locale to/from the request. See the documentation for more information.

Host Resolution

It is now possible to validate a resolved host against a list regular expressions patterns. See the documentation for more information.

Cloud Features

New CI/CD Deployment Workflows for Github Actions in Launch

Micronaut Launch has been updated to include CI/CD workflows to deploy to common container based Cloud environments including Oracle Cloud Function, Azure Container Instance and Google Cloud Run.

Combined with the ability to Push to Github this makes it a breeze to setup Micronaut applications to be deployed to the Cloud.

Google Cloud Secret Manager

Thanks to a contribution by Vinicius Carvalho, Micronaut GCP supports distributed configuration via Google Cloud Secret Manager.

Micronaut JMS

A new Micronaut JMS module (currently in preview) to support JMS messaging including ActiveMQ and Amazon SQS has been added with full support for GraalVM native image. See the Micronaut JMS documentation for more information.

Module Upgrades

  • Micronaut XML 2.1.02.2.1

  • Micronaut Cache 2.2.02.3.0

  • Micronaut Security 2.2.22.3.0

  • Micronaut Spring 2.1.23.2.0

  • Micronaut GCP 3.3.03.4.0

  • Micronaut AWS 2.2.52.3.0

  • Micronaut OpenAPI 2.2.22.3.0

  • Micronaut SQL 3.3.53.4.0

  • Micronaut Views 2.1.02.2.1

  • Micronaut Test 2.2.12.3.2

  • Micronaut PicoCLI 3.1.03.2.0

  • Micronaut RabbitMQ 2.2.22.3.2

  • Micronaut Flyway 3.1.03.3.0

  • Micronaut Kubernetes 2.1.02.2.0

  • Micronaut Multitenancy 2.2.33.0.0 (Group ID changed to io.micronaut.multitenancy)

  • Micronaut JMS (new) 1.0.0.M1

Dependency Upgrades

  • PicoCLI 4.5.24.6.1

  • Caffeine 2.8.62.8.8

  • Netty 4.1.56.Final4.1.58.Final

  • Spring 5.2.9.RELEASE5.3.1

  • Spring Boot 2.3.4.RELEASE2.4.0

  • GraalVM 20.3.021.0.0

  • Tomcat JDBC 9.0.409.0.41

  • Flyway 7.0.47.4.0