Learn MICRONAUT with Real Code Examples
Updated Nov 25, 2025
Installation Setup
Install JDK 11+
Install Micronaut CLI via SDKMAN or homebrew
Create new project: `mn create-app my-app`
Open project in IDE (IntelliJ, VS Code)
Run: `./gradlew run` or `mn run`
Environment Setup
Install JDK 11+
Install Micronaut CLI
Set up Gradle or Maven
Open project in IDE
Verify run with `mn run`
Config Files
application.yml - configuration
build.gradle / pom.xml - build scripts
src/main/java - source code
src/test/java - tests
Dockerfile - containerization
Cli Commands
mn create-app my-app -> generate new project
mn run -> run application
./gradlew build -> build project
mn test -> run tests
docker build/run -> containerize application
Internationalization
Supports UTF-8 out of the box
Locale-specific content via configuration
Integrates with third-party i18n libraries
Used globally for multilingual apps
Custom translation pipelines possible
Accessibility
Framework-agnostic
Supports CORS and HTTP standards
Accessible via REST clients
Works on all JVM-supported platforms
Security and middleware configurable
Ui Styling
Not handled - backend framework
Serve static files if needed
Return JSON/XML API responses
Integrate with frontend frameworks
Optional template rendering via Micronaut Views
State Management
Stateless by default
Session support via JWT or cookies
Persistent state in DB or cache
Reactive streams for ephemeral state
DI-managed beans maintain scoped state
Data Management
Handle JSON, XML, and other payloads
Integrate with relational and NoSQL databases
Reactive and non-blocking database access
Validate input with Micronaut Validation
Logging and monitoring of data flow