[JAVA] Introduction to Micronaut 1 ~ Introduction ~

Purpose

Spring type FW is often adopted in SIer, but Micronaut is influenced by existing famous FW, so the introduction barrier seems not to be so high and it is a technology that overcomes the drawbacks of existing FW. A memo after the investigation.

What is Micronaut

A modern JVM-based full-stack microservices framework designed for building microservices applications. Micronaut provides all the functionality to build microservices. At the same time, it provides the following to avoid the shortcomings of frameworks like Spring, Spring Boot, and Grails:

Although it seems that it is not suitable for the SI industry due to its business model, it is designed for microservices.

Environment

--Java 8 or higher SDK is included --Install Micronaut CLI with SDKMAN

Installing SDKMAN
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk update
$ sdk install micronaut 1.1.0.M1

Creating a server app

Creating a template project

--features file-watch has auto-reload function

$ mn create-app my-app --features file-watch
$ cd my-app
$ ./gradlew run --continuous
Creating a controller

HelloController.java


import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;

@Controller("/hello")
public class HelloController {
    @Get(produces = MediaType.TEXT_PLAIN)
    public String index() {
        return "hello world!!";
    }
}

http://localhost:8080/hello Hello world !! is displayed by accessing. It detects file changes and restarts. It doesn't start up anymore, and I don't feel any lightness.

reference

https://docs.micronaut.io/1.1.0.M1/guide/index.html

Recommended Posts

Introduction to Micronaut 1 ~ Introduction ~
Introduction to Micronaut 2 ~ Unit test ~
Introduction to Ruby 2
Introduction to web3j
[Java] Introduction to Java
Introduction to migration
Introduction to java
Introduction to Doma
Introduction to JAR files
Introduction to bit operation
Introduction to Ratpack (6) --Promise
Introduction to Ratpack (9) --Thymeleaf
Introduction to PlayFramework 2.7 ① Overview
Introduction to design patterns (introduction)
Introduction to Practical Programming
Introduction to javadoc command
Introduction to jar command
Introduction to Ratpack (2)-Architecture
Introduction to lambda expression
Introduction to java command
Introduction to RSpec 2. RSpec setup
Introduction to Keycloak development
Introduction to javac command
Introduction to RSpec 5. Controller specs
Introduction to RSpec 6. System specifications
Introduction to Android application development
Introduction to RSpec 3. Model specs
Introduction to Ratpack (5) --Json & Registry
Introduction to Metabase ~ Environment Construction ~
Introduction to Ratpack (7) --Guice & Spring
(Dot installation) Introduction to Java8_Impression
Introduction to JUnit (study memo)
Introduction to Spring Boot ① ~ DI ~
Introduction to design patterns (Flyweight)
[Java] Introduction to lambda expressions
Introduction to Spring Boot ② ~ AOP ~
Introduction to Apache Beam (2) ~ ParDo ~
[Ruby] Introduction to Ruby Error statement
Introduction to EHRbase 2-REST API
Introduction to design patterns Prototype
GitHub Actions Introduction to self-made actions
[Java] Introduction to Stream API
Introduction to Design Patterns (Iterator)
Introduction to Spring Boot Part 1
Introduction to Ratpack (1) --What is Ratpack?
XVim2 introduction memo to Xcode12.3
to_ ○
Introduction to RSpec-Everyday Rails Summary-
Introduction to Design Patterns (Strategy)
[Introduction to rock-paper-scissors games] Java
Introduction to Linux Container / Docker (Part 1)
Introduction to swift practice output Chapter5
[Introduction to Java] About lambda expressions
Introduction to algorithms in java-cumulative sum
[Introduction to Java] About Stream API
Introduction to Functional Programming (Java, Javascript)
Introduction to Ruby processing system self-made
Introduction to algorithms with java-Shakutori method
Introduction to Design Patterns (Factory Method)
Introduction to Linux Container / Docker (Part 2)
Introduction to Design Patterns (Abstract Factory)