Integrating Micronaut With GCP

Reading Time: 2 minutes

In this blog, we will cover how Micronaut is integrated with the Google Cloud Platform (GCP)

What is Micronaut

Micronaut is an open-source JVM-based software framework for building lightweight, modular applications and microservices.

Google Cloud

It is a provider of computing resources for developing, deploying, and operating applications on the Web.


  • We will need a “micronaut-gcp-common” maven dependency in order to run our application on the Google Platform.
  • We should have a Google Cloud account or a free trial account in order to set up a Google Cloud project on the console.
  • We can create a Google Cloud project from the Google Cloud UI itself or install the “gcloud CLI”.
  • It’s strongly recommended that you use a Service Account for your application.


We are going to deploy a Micronaut application as an HTTP Function to Google Cloud

  • The Controller Class
  • Next, Google Cloud requirements: We need a Google Cloud account and also a Google Cloud project.
  • Deployment
    • Create an executable jar including all dependencies:
      ./mvnw package
  • You need a single JAR. Delete every ‘jar’ except <you_project_name>-0.1.jar in your target directory (where the jar is present).
  • Next run:
      gcloud functions deploy <project_name>
       --entry-point io.micronaut.gcp.function.http.HttpFunction
       --runtime java11
  • To get the trigger URL, do the following:
      YOUR_HTTP_TRIGGER_URL=$(gcloud functions describe <project_name>
  • Now using the above variable we can test the function invocation:
      curl -w "\n" $YOUR_HTTP_TRIGGER_URL/<your_endpoint>
  • Finally, we will see the below response on this trigger URL:
      Example Response


Hence, we have seen above how to integrate Micornaut with the Google platform with an example of how to deploy a Micronaut application as an HTTP Function to Google Cloud and get the response using the trigger URL.