Skip to content

Micronaut 5 Module Checklist

Sergio del Amo edited this page Dec 2, 2025 · 27 revisions

Example PR

This pull request highlights most of the changes required in the checklist

Checklist

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}

Remove it (we must not use toolchains).

  • Use instead:

eg for Java baseline : plugin-> id "io.micronaut.build.internal.java-base" for kotlin baseline : plugin -> id "io.micronaut.build.internal.kotlin-base"

  • if the build fails test compilation, most likely tests were accidentally using JUnit 4 annotations or assertions. Use JUnit 5 : change test imports

  • In order to use the default Groovy, Micronaut Docs, Micronaut Test, Micronaut Logging, Spock, JUnit versions remove from gradle/libs.versions.toml:

-micronaut-docs = "3.0.0"
-micronaut-test = "4.9.0"
-groovy = "4.0.13"
-spock = "2.3-groovy-4.0"
-junit5 = "5.14.0"
 kotlin = "2.2.21"
-micronaut-logging = "1.7.1"
  • Java 25 introduces java.lang.IO, so if a Groovy test uses @ExecuteOn(IO) it will fail compilation even with a static import.

JSpecify

Micronaut 5 modules should replace Micronaut Nullability annotations with JSpecify Nullability annotations. We need to replace usages of io.micronaut.core.annotation.Nullable with org.jspecify.annotations.Nullable and usages of io.micronaut.core.annotation.NonNull with org.jspecify.annotations.NonNull

Full Qualified Types

When specifying the full qualified type, with Micronaut nullability annotations you could have:

public ReadBuffer adapt(@NonNull io.micronaut.core.io.buffer.ByteBuffer<?> buffer) {

With JSpecify you need to have:

public ReadBuffer adapt(io.micronaut.core.io.buffer.@NonNull ByteBuffer<?> buffer) {
Inner classes

For inner classes, Micronaut annotations you could do:

public FileChangedEvent(@NonNull Path path, @NonNull WatchEvent.Kind eventType) {

With JSpecify, you will need to do:

public FileChangedEvent(@NonNull Path path, WatchEvent.@NonNull Kind eventType) {

Update to Jackson 3

micronaut-jackson-databind using Jackson 3. Check Jackson3 upgrade guide or Jackson 3 release notes.

You can also use the Upgrade from Jackson 2 to Jackson 3 open rewrite recipe.

plugins {
...
    id("org.openrewrite.rewrite")
}
repositories {
    mavenCentral()
}
rewrite {
    activeRecipe("org.openrewrite.java.jackson.UpgradeJackson_2_3")
}
dependencies {
    rewrite("org.openrewrite.recipe:rewrite-jackson:1.11.0")
    compileOnly("tools.jackson.core:jackson-databind:2.17.2")
  • Replace com.fasterxml.jackson.databind.annotation.JsonDeserialize with tools.jackson.databind.annotation.JsonDeserialize.

  • Replace tools.jackson.databind.annotation.JsonPOJOBuilder with tools.jackson.databind.annotation.JsonPOJOBuilder.

  • Replace com.fasterxml.jackson.databind.JsonNode with tools.jackson.databind.JsonNode

  • Replace com.fasterxml.jackson.databind.node.JsonNodeFactory with tools.jackson.databind.node.JsonNodeFactory

  • Replace com.fasterxml.jackson.databind.node.ObjectNode with tools.jackson.databind.node.ObjectNode

  • Replace com.fasterxml.jackson.databind.ObjectMapper with tools.jackson.databind.ObjectMapper

  • Replace com.fasterxml.jackson.databind.PropertyNamingStrategies with tools.jackson.databind.PropertyNamingStrategies

  • Replace com.fasterxml.jackson.core.JsonParser with tools.jackson.core.JsonParser.

  • Replace com.fasterxml.jackson.core.JsonToken with tools.jackson.core.JsonToken.

  • Replace com.fasterxml.jackson.core.JsonFactory with tools.jackson.core.json.JsonFactory

  • Replace com.fasterxml.jackson.core.StreamWriteFeature with tools.jackson.core.StreamWriteFeature.

  • Replace com.fasterxml.jackson.core.json.JsonReadFeature with tools.jackson.core.json.JsonReadFeature.

  • Replace com.fasterxml.jackson.core.json.JsonWriteFeature with tools.jackson.core.json.JsonWriteFeature.

  • Replace com.fasterxml.jackson.core.JsonFactoryBuilder with tools.jackson.core.json.JsonFactoryBuilder.

  • Replace com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider. with tools.jackson.databind.ser.std.SimpleFilterProvider

  • Replace com.fasterxml.jackson.core.JsonGenerator with tools.jackson.core.JsonGenerator.

  • Replace com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor with tools.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.

  • Replace com.fasterxml.jackson.databind.ser.BeanPropertyWriter with tools.jackson.databind.ser.BeanPropertyWriter.

  • Replace com.fasterxml.jackson.databind.ser.PropertyFilter with tools.jackson.databind.ser.PropertyFilter.

  • Replace com.fasterxml.jackson.databind.ser.PropertyWriter with tools.jackson.databind.ser.PropertyWriter.

exceptions

  • Somes instances of com.fasterxml.jackson.core.JsonParseException are now tools.jackson.core.JacksonException.
  • com.fasterxml.jackson.databind.JsonMappingException (root for databind exceptions) becomes tools.jackson.databind.DatabindException

Clone this wiki locally