2 Writing the App

The previous command createas a micronaut app with the default package example.micronaut in a folder named complete.

Due to the --features kotlin flag, it generates a Kotlin Micronaut app and it uses Gradle build system. However, you could use
other build tool such as Maven or other programming languages such as Java or Groovy.

If you are using Java or Kotlin and IntelliJ IDEA make sure you have enabled annotation processing.

Kotlin, Kapt and IntelliJ

As of this writing IntelliJ’s built-in compiler does not directly support Kapt and annotation processing. You must instead configure Intellij to run Gradle (or Maven) compilation as a build step before running your tests or application class.

First edit the run configuration for tests or for the application and select "Run Gradle task" as a build step:

Then add the classes task as task to execute for the application or for tests the testClasses task:

Now whenever you run tests or the application Micronaut classes will be generated at compilation time.

Alternatively, you can delegate IntelliJ build/run actions to gradle completely:

3 Management

Inspired by Spring Boot and Grails, the Micronaut management dependency adds support for monitoring
of your application via endpoints: special URIs that return details about the health and state of your application.

To use the management features described in this section, add the dependency on your classpath. For example, in build.gradle

build.gradle

dependencies {
...
..
compile "io.micronaut:micronaut-management"
}

4 Info endpoint

The info endpoint returns static information from the state of the application. The info exposed can be provided by any number of "info sources".

Enable the info endpoint:

src/main/resources/application.yml

endpoints:
info:
enabled: true
sensitive: false

5 Gradle Git Properties Plugin

If a git.properties file is available on the classpath, the GitInfoSource
will expose the values in that file under the git key. Generating of a git.properties file will need to be configured
as part of your build; for example, you may choose to use the Gradle Git Properties plugin. The plugin
provides a task named generateGitProperties responsible for the git.properties file generation. It is automatically invoked upon the execution of the classes task. You
can find the generated file in the directory build/resources/main.