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:
package example;
import io.micronaut.context.annotation.*;
import javax.validation.constraints.*;
@ConfigurationProperties("example")
record Example(@Min(20) int num, String name) {
}
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:
val introspection = BeanIntrospection.getIntrospection(Example.java);
Example example = introspection.instantiate(10, "Test");
assertEquals(10, example.num());
example = introspection.getRequiredProperty("num", int.class)
.withValue(example, 20);
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.0
→2.2.1
Micronaut Cache
2.2.0
→2.3.0
Micronaut Security
2.2.2
→2.3.0
Micronaut Spring
2.1.2
→3.2.0
Micronaut GCP
3.3.0
→3.4.0
Micronaut AWS
2.2.5
→2.3.0
Micronaut OpenAPI
2.2.2
→2.3.0
Micronaut SQL
3.3.5
→3.4.0
Micronaut Views
2.1.0
→2.2.1
Micronaut Test
2.2.1
→2.3.2
Micronaut PicoCLI
3.1.0
→3.2.0
Micronaut RabbitMQ
2.2.2
→2.3.2
Micronaut Flyway
3.1.0
→3.3.0
Micronaut Kubernetes
2.1.0
→2.2.0
Micronaut Multitenancy
2.2.3
→3.0.0
(Group ID changed toio.micronaut.multitenancy
)Micronaut JMS (new)
1.0.0.M1
Dependency Upgrades
PicoCLI
4.5.2
→4.6.1
Caffeine
2.8.6
→2.8.8
Netty
4.1.56.Final
→4.1.58.Final
Spring
5.2.9.RELEASE
→5.3.1
Spring Boot
2.3.4.RELEASE
→2.4.0
GraalVM
20.3.0
→21.0.0
Tomcat JDBC
9.0.40
→9.0.41
Flyway
7.0.4
→7.4.0