Have you heard of Azure Spring Cloud? Azure Spring Cloud is a fully managed service for Spring Boot apps that allows you to focus on building apps that run your business without having to manage infrastructure. It allows you to use the Spring Boot language, which is Java-based, to the cloud using microservices.

In this post, I’ll walk through how to get started with Spring Cloud to deploy a simple Azure Spring Cloud microservices application. You can also check out the video I’ve included to see my demo in action or follow the quick start document found in Microsoft Docs.

  • First, be sure to check out the list of prerequisites that you’ll need to have to get started.
  • You’ll start in the Spring Intializr where you’ll enter in your parameters and generate the code. It will download a zip file which you’ll use later in the project. You can find several cloud examples for Spring Cloud on the GitHub site.
  • Next, we must install a couple of things, the Spring Framework, and the Azure Toolkit for IntelliJ. IntelliJ is a tool that allows you to write the code in the IDE. There is a Community Edition and the Ultimate Edition. I used the Community edition, but the Ultimate has a 30-day trial. We also have to install the Azure CLI and Apache Groovy.
  • Now, let’s talk about the IDE in the environment. This IntelliJ environment is where you can create new projects, hook it up to Git, as well as many other things.
  • For my project, I start in IntelliJ and I created the shell by clicking on File>New and then create a project and I created the structure. I ingested that zip file that I go earlier in the Spring Initializr. We’ll see the source files it generated for us which is a Java file.
  • Configuration setting: There is an icon on the top right and when you click on it, this is where you’ll specify different settings. One thing is the project SDK which you’ll need a version of Java. After trying a few different versions, I had the best luck with version 16. Remember, you also must set your environment variables and your classpath and such so that it can talk to Java

1.  Next, we set our modules. You can set the source and resources. I can also run a test and set files that I want to exclude.
2.  We can also add libraries. If I go back to the Spring Initialzr screen, you can see I set this up to be a Maven project using the Java language. In the project settings, we have a tab for artifacts, and in platform settings, we have a tab for SDKs and global libraries

  • Back to our application build. The next thing we do is to build the application and after a few tries, we were able to compile our Spring Cloud app.
  • Another feature we have is the ability to log into Azure, select our subscription, and in my case, I used my Visual Studio MPN setting. The next step is deploying my app.
  • To do this I click on Run and then create a configuration file. It already pre-populated the artifact for me but you need to specify your subscription and then run it. It only took a few minutes and mine ran without errors.
  • So, we created an Azure Spring Cloud, and I added the log analytics by default and the application insights. If I click on the Azure Spring Cloud I created, it takes me to another page where I can click on Apps and there’s my app I created. I can click on that to see that it’s up and running, so it was successful end to end.

Why would you want to use Azure Spring Cloud? We would use Java to make microservices to connect to a variety of different sources on the Azure site, for example, we can do Cosmos, HDInsight, SQL Server Big Data Cluster, and Azure Synapse.

The nice thing here is that some of this code pre-written for you. So, if you’re familiar with Java, it does much of the heavy lifting with just a few lines of code. I highly recommend it and I’m looking forward to using this on an upcoming project.

Need further help? Our expert team and solution offerings can help your business with any Azure product or service, including Managed Services offerings. Contact us at 888-8AZURE or  [email protected].