These tutorials target Micronaut Framework 3. Read, Guides for Micronaut Framework 4.

Application Class - Spring Boot to Micronaut Framework

This guide shows compares the Application Class of a Spring Boot application vs a Micronaut Framework application.

Authors: Sergio del Amo

Micronaut Version: 3.9.2

1. Sample Project

You can download a sample application with the code examples shown in this article.

2. Introduction

Spring Boot and Micronaut applications contain a simple application class which starts the application for you.

3. Spring Boot Application Class

springboot/src/main/kotlin/example/micronaut/Application.kt
package example.micronaut

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class Application

fun main(args: Array<String>) {
  runApplication<Application>(*args)
}

3.1. Micronaut Framework Application Class

micronautframework/src/main/kotlin/example/micronaut/Application.kt
package example.micronaut

import io.micronaut.runtime.Micronaut.run
fun main(args: Array<String>) {
        run(*args)
}

Except for the @SpringBootApplication annotation, both classes are almost identical. :-]

4. Next steps

Read more about Micronaut Spring.

5. Help with the Micronaut Framework

The Micronaut Foundation sponsored the creation of this Guide. A variety of consulting and support services are available.