Migrate from Micronaut 2.x to 3.x

Apache 2.0

This recipe will apply changes required for migrating from Micronaut 2 to Micronaut 3.

org.openrewrite.java.micronaut.Micronaut2to3Migration
mod run . --recipe=org.openrewrite.java.micronaut.Micronaut2to3Migration

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change type javax.annotation.Nullable to io.micronaut.core.annotation.Nullable
  2. Change type Nonnull to NonNull
  3. Migrate to Jakarta EE 9
  4. De-capitalize BeanIntrospection getProperty(..) and getRequiredProperty(..) name arguments
  5. Copy non-inherited annotations from super class
  6. Change factory method return types to reflect their resolved return type
  7. Convert OncePerRequestServerFilter extensions to HttpServerFilter
  8. Provider implementation beans to Micronaut @Factory
  9. Add @Introspected to classes requiring a map representation
  10. Fix deprecated no-arg ExceptionHandler constructors
  11. Upgrade Maven parent project version to io.micronaut:micronaut-parent:3.x
  12. Upgrade Maven dependency version io.micronaut:micronaut-bom:3.x
  13. Upgrade gradle.properties Micronaut version 3.x
  14. Upgrade micronaut.version Maven property 3.x
  15. Rename package name io.micronaut.configuration.cassandra to io.micronaut.cassandra
  16. Rename package name io.micronaut.configuration.security.ldap to io.micronaut.security.ldap
  17. Change method name io.micronaut.context.ApplicationContext build(..) to builder
  18. Change type io.micronaut.core.async.SupplierUtil to io.micronaut.core.util.SupplierUtil
  19. Change method name io.micronaut.http.netty.stream.DelegateHttpRequest getMethod() to method
  20. Change method name io.micronaut.http.netty.stream.DelegateHttpResponse getStatus() to status
  21. Change method name io.micronaut.http.server.netty.DelegateHttpResponse getStatus() to status
  22. Change method name io.micronaut.http.netty.stream.DelegateHttpRequest getUri() to uri
  23. Change method name io.micronaut.http.netty.stream.DelegateHttpMessage getDecoderResult() to decoderResult
  24. Change method name io.micronaut.http.netty.stream.DelegateHttpMessage getProtocolVersion() to protocolVersion
  25. Change type RxJavaBeanDefinitionDataCollector to DefaultBeanDefinitionDataCollector
  26. Change type RxJavaRouteDataCollector to DefaultRouteDataCollector
  27. Change type RxJavaHealthAggregator to DefaultHealthAggregator
  28. Change type Body to MessageBody
  29. Change type Headers to MessageHeaders
  30. Change method name io.micronaut.rss.itunespodcast.ItunesPodcast isExplict() to isExplicit
  31. Change method name io.micronaut.rss.itunespodcast.ItunesPodcast setExplict(boolean) to setExplicit
  32. Change method name io.micronaut.rss.itunespodcast.ItunesPodcast explict(boolean) to setExplicit
  33. Change method name io.micronaut.rss.itunespodcast.ItunesPodcastEpisode isExplict() to isExplicit
  34. Change type io.micronaut.runtime.server.EmbeddedServerInstance to io.micronaut.discovery.EmbeddedServerInstance
  35. Change type io.micronaut.http.client.RxHttpClient to io.micronaut.rxjava2.http.client.RxHttpClient
  36. Change type io.micronaut.http.client.RxProxyHttpClient to io.micronaut.rxjava2.http.client.proxy.RxProxyHttpClient
  37. Change type io.micronaut.http.client.RxStreamingHttpClient to io.micronaut.rxjava2.http.client.RxStreamingHttpClient
  38. Change type io.micronaut.http.client.sse.RxSseClient to io.micronaut.rxjava2.http.client.sse.RxSseClient
  39. Change type io.micronaut.websocket.RxWebSocketClient to io.micronaut.rxjava2.http.client.websockets.RxWebSocketClient
  40. Change method name io.micronaut.web.router accept(io.micronaut.http.MediaType) to doesConsume
  41. Change method name io.micronaut.web.router.Route acceptAll() to consumesAll
  42. Change method name io.micronaut.web.router.RouteMatch accept(io.micronaut.http.MediaType) to doesConsume
  43. Change method name io.micronaut.web.router.RouteMatch explicitAccept(io.micronaut.http.MediaType) to explicitlyConsumes
  44. Change type io.micronaut.test.annotation.MicronautTest to io.micronaut.test.extensions.junit5.annotation.MicronautTest