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/java/example/micronaut/Application.java
package example.micronaut;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
        public static void main(String[] args) {
                SpringApplication.run(Application.class, args);
        }
}

3.1. Micronaut Framework Application Class

micronautframework/src/main/java/example/micronaut/Application.java
package example.micronaut;

import io.micronaut.runtime.Micronaut;

public class Application {

    public static void main(String[] args) {
        Micronaut.run(Application.class, 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.