In my code, I’ve injected a property to indicate which profile it is reading from. The first step is to create a simple controller. Mn create-app -on-app-engine -build=gradle -lang=java -features=graalvmĪt this point, you will have a shell of an application with most of what you will need. Use Micronaut to create your application: The full source code of my example application can be found on GitHub, but I will walk through it and point out a few gotchas. If you are given a choice, choose the “standard” environment (instead of “flex”). GraalVM – Install with SDKMan (version may be different)Ĭreate a GCP account and an App Engine project. SDKMan – A great tool to have installed anyway! I will not go into detail on how they are installed, but will have links available to get you started. ![]() Several prerequisites are needed to get started, some of which may already exist for you. In a real environment, a CI/CD pipeline will exist where the binary is built using Linux in a Docker container. The binaries compiled on MacOS or Windows probably will not work on Google App Engine. Another benefit of Micronaut is that it looks a lot like Spring when developing an application, so it is a fairly easy transition for those Spring developers out there.īefore going any further into this post, I should note that I did all development on Linux. Even better, Micronaut has a lot of support for building natively compiled binaries using GraalVM, which makes startup time and memory consumption even lower. Micronaut’s fast startup speed is attributed to how it does all of its dependency injection and AOP type operations at compile time. Another framework that touts its ability to start up quickly is Micronaut. Even a moderately sized Spring application can take many seconds to start up. You want your application to start quickly so that first request doesn’t have to wait too long to be served. When a request comes in, App Engine will start up an instance for you automatically. If your application deployed on App Engine is not serving any requests, it is scaled down to zero instances automatically. ![]() So, I thought I’d investigate further since I was only aware of deploying a war or jar type artifact to App Engine. Recently, while reading about natively compiled Java, I came across a tidbit that said that Java compiled as a native binary can be deployed to the App Engine Standard Environment.
0 Comments
Leave a Reply. |