Multi-Module Spring Boot Project with Azure

Updated: Feb 2


Spring Boot with Azure

In this blog, I will explain how one can start with a multi-module spring project in no time. At the end of the blog, I have added the section of How to use. For a detailed explanation, I have splitter this blog into different parts ( Check the end of the blog, for link).


I have also published my code in GitHub. As of now, this solution utilises Microsoft Azure Resource like

  • Azure Storage for storing files.

  • Azure Active Directory for Authorization and Authentication.

  • Application Insight for debugging request.

  • Azure Key Vault for Storing Secrets.

  • AKS for deploying the Microservice,

  • Azure Multi-Stage Pipeline for deployment.

  • Azure Container Registry for storing docker images.


Spring Boot and Me


I am working on Spring Boot for the past eight months, and before that, I only heard about Spring Boot, and I was mainly using Javascript and Typescript for coding software. I still remember the first version of my Spring Boot Code; it was a mess. I created 5 Microservice in the beginning. And I face so many problems.

  • It had a lot of code duplication.

  • Whenever I had to create new Microservice, I had to add all dependencies, again and again.

  • Logging, exception handling, security and many other cross-cutting concerns were not consistence.

  • Whenever there is a bug in Cross-Cutting concerns like Logging, Exception, Security, I had to fix it in every Microservice.

How did I fix my relationship with Spring Boot?


I started looking for a Multi-Module Project approach. It took time to figure out a way to implement this approach, that can address all the problems mentioned above. Eventually, I managed to create a multi-module project, that is now serving as a base for my project. It has many capabilities:

  • Out of the Logging for Service, Repository and Controllers.

  • Enables logging for other functions, that are not part of Service, Repository and controller, with just single annotation.

  • Enable/Disable security with just one annotation.

  • Captures function execution times.

  • Easy Azure AD integration.

  • Out of the box exception handling for most common exceptions.

  • Able to send logs to Application Insight, without adding any code to classes.

  • Enable/ Disable Swagger with just single annotation.

  • Out of the box, JSON formatted logs in the console.

  • Allows easy integration Azure Blob Storage.

  • Enable/ Disable Azure AD Authentication for Swagger.


How to use


For the final code, check out my GitHub Implementation. For Step by Step Instruction, see below:


Step 1: Clone my GitHub repository.

Step 2: Load Parent Pom.xml to load the complete project.


Snip highlighting Parent pom.xml


Step 3: Create a new Maven Module. In this demo, I am using IntelliJ.

Make sure to create a new service under the application folder and new library under the lib folder.

How to create new maven module

Step 4: Replace Pom.xml content.




Step 5: Add application. yaml file under resource folder



Step 6: Create Application.java class under the root package.


If you want to learn detailed implementation of this Project, please refer below link, I have divided the explanation into different parts:

I hope this implementation will help you in getting started with Spring Boot Multi-Module Project in no time.


Stay tuned for other parts. Please feel free to let me know if anyone needs more content on spring Boot or azure.


Comments and feedback are most welcomed.


Please follow me on Linkedin, Github, and join our newsletter to keep yourself updated.


Thanks for reading. Happy Learning 😊

601 views

Recent Posts

See All