This is the introductory post in a series that will guide you through the migration from Grails to Micronaut. This guide requires your…


Goodbye Grails, Hello Micronaut #0: Introduction

This is the introductory post in a series that will guide you through the migration from Grails to Micronaut. This guide requires your application to be based on Grails 4.x or later.

Grails describes itself as a powerful Groovy-based web application framework for the JVM built on top of Spring Boot. Micronaut is a modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications. This is an introductory post in the series showing how to migrate from Grails to Micronaut.

I was sitting in the audience when the Grails team announced something big at Greach 2018. Nearly twelve years after the initial release of Grails in 2006 there was something new that looked like a fresh version of Grails as if it was invented nowadays — cloud-enabled, Java and Kotlin friendly, focused on API endpoints and on serverless. And I am still keeping this point of view — seeing Micronaut as a successor of Grails. This series should help you move your application up to date with the latest trends.

After migration to Micronaut your application will be:

  • cloud-native
  • more lightweight
  • more language agnostic

Please, pay attention, that this guide is focused on modern JSON-serving applications that do not render pages server-side using GSPs but some separate articles may be published later.

This series is divided into smaller steps that guide you through the migration process. The order of the posts has been arranged carefully to minimize radical changes to keep your application working all the time.

In the first article called Multiproject, you will make your application ready for extracting Micronaut-ready parts.

Next, you will make the first baby step by migrating the Configuration into objects.

Adding Static Compilation will create yet another safe point to prevent breaking the application.

Assuming the test coverage of your application is not ideal, you will create reusable Datasets for the tests we are going to create in the next steps.

In the fifth post called Marshalling, we stop relying on Grails JSON conversion but we’re going to switch to Jackson one which is native to Micronaut.

The Domain Classes are the core objects of any Grails application. We will learn how to extract them into a separate library so we can later use them in the new Micronaut application.

Once the domain classes are extracted we can also move the Services and make them Micronaut beans which can be injected into Grails artifacts.

Next, we will create Micronaut’s version of the Grails Controllers.

And finally, we will glue all the pieces together into the new Micronaut Application.

As the last step, we leave the Grails ecosystem completely by migrating from GORM to Micronaut Data.

Table of Contents

  1. Multiproject
  2. Configuration
  3. Static Compilation
  4. Datasets
  5. Marshalling
  6. Domain Classes
  7. Services
  8. Controllers
  9. Micronaut Application
  10. Micronaut Data

Sources & Discussion

[GitHub - agorapulse/goodbye-grails-hello-micronaut: Goodbye Grails, Hello Micronaut

github.com