This is a "Hello World" Micronaut CLI program.
An effective way to start learning a new framework is with a basic example. This is a so-called "Hello World" program
implemented in Java and the Micronaut. I scaffolded this with the Micronaut mn
CLI
and adapted it from there.
Follow these instructions to build and run the program.
- Use Java 21
- Build and run the app:
-
./gradlew run
-
- Build and run the tests:
-
./gradlew test
-
- Build the app distribution and then run it:
-
./gradlew installDist
-
./build/install/basic/bin/basic
- The output should look like this:
$ ./build/install/basic/bin/basic 00:36:42.830 [main] INFO i.m.c.DefaultApplicationContext$RuntimeConfiguredEnvironment - Established active environments: [cli] 00:36:42.875 [main] INFO d.basic.BasicApplication$MyFactory - Hello world!
-
General clean-ups, TODOs and things I wish to implement for this project:
- DONE Convert to Gradle Kotlin DSL
- DONE Remove web server and just make the app say "hello world"
- DONE Upgrade to Java 11
- GitHub Actions CI build
- DONE Upgrade to Micronaut 3
- DONE Upgrade to Micronaut 4
- See migration guide
- See the OpenRewrite Migrate to Micronaut 4 from Micronaut 3 recipe
- Unfortunately, the OpenRewrite plugin only removed the "jansi" part but didn't get the SnakeYAML dependency, or the Micronaut Validation change. I suppose it would be hard to do non-actual-code changes like that.
- Micronaut docs: User Guide
- Micronaut docs: API Reference
- Micronaut docs: Configuration Reference
- Micronaut docs: Micronaut Guides
- Micronaut docs: HTTP Client documentation
- Micronaut docs: Upgrading to Micronaut 3.x
- micronaut-gradle-plugin
- StackOverflow question/answer: Micronaut features lists cannot be changed by the CLI
- Will I screw something up if I remove the 'netty-server' feature from my feature list? UPDATE: well I did it, and the
mn
Micronaut command line still seems to work.
- Will I screw something up if I remove the 'netty-server' feature from my feature list? UPDATE: well I did it, and the