Application Class - Spring Boot

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

Authors: Sergio del Amo

Micronaut Version: 4.6.3

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.

6. License

All guides are released with an Apache license 2.0 license for the code and a Creative Commons Attribution 4.0 license for the writing and media (images…​).