Posts

Showing posts with the label Spring Boot

Scheduled Bulk SMS with Azure Communication Services, Spring Boot, Spring Batch & Quartz

Image
Here's a short explanation of each step: User starts the Spring Boot Application . SpringBoot schedules a batch job using Quartz Scheduler (runs every 5 minutes). Quartz triggers the batch job. Batch fetches customer data (phone numbers and messages) from the Database . Batch sends the SMS messages using the SMS Service . SMS Service interacts with Azure Communication Services (ACS) to send the SMS. ACS returns the delivery status to the SMS Service . SMS Service sends the status back to Batch . Batch notifies Quartz about job completion. Quartz informs SpringBoot that the job is complete. This diagram visually represents the flow of actions in the system, detailing the interaction between different components and how the batch SMS process is executed and monitored. Here's a step-by-step guide on how to schedule and send batch SMS using Azure Communication Services (ACS) with Spring Boot , Quartz Scheduler , and Spring Batch . 1. Prerequisites Ensure you have: Az...

3 Ways to Dockerize Your Spring Boot Application: Dockerfile, Jib, and Buildpacks

Image
Here’s a guide to generate a Docker image for a Spring Boot application using three different methods . Each method has its use case, depending on your project's needs and complexity. 1. Using a Dockerfile This method gives you full control over the image creation process. Steps: Create a Dockerfile : Create a file named Dockerfile in the root directory of your Spring Boot project with the following content: FROM openjdk: 17 -jdk-slim ARG JAR_FILE=target/app.jar COPY ${JAR_FILE} app.jar ENTRYPOINT [ "java" , "-jar" , "/app.jar" ] Build the JAR file: Package your application into a JAR file: mvn clean package Build the Docker image: Run the following command to build the Docker image: docker build -t spring- boot - app . Run the Docker container: Start the container: docker run -p 8080:8080 spring- boot - app 2. Using Jib (Maven/Gradle Plugin) Jib is a tool from Google that simplifies the process of creating Docker images without needing a D...

JWT Authentication and Authorization with Spring Boot and Vue.js: Complete Guide

Image
Here's a brief explanation of the diagram's flow: Actors: User (U): Represents the end user interacting with the application. LoginComponent (LC): The component in the frontend (Vue.js) where the user enters login credentials. AuthService (AS): A service in the frontend responsible for handling authentication, such as calling the backend to log in and storing the JWT token and user roles in local storage. LocalStorage (LS): A storage mechanism for saving the JWT token and user roles in the frontend. AuthController (AC): The backend controller responsible for handling authentication requests (e.g., login). JwtTokenUtil (JTU): A utility in the backend that generates and validates JWT tokens. UserController (UC): A backend controller that handles user-related routes. SecurityConfig (SC): A backend configuration that defines security rules and role-based access control. Flow: User Login: The User enters their credentials into the LoginComponent (LC). The LoginComponent sends the cr...

Deploy a Spring Boot Application on Azure App Service Using GitHub Actions CI/CD

Image
Follow this step-by-step guide to deploy your Spring Boot application to Azure App Service using GitHub Actions for seamless CI/CD. Here is the general architecture diagram that we will be deploying. Step 1: Prerequisites Set Up Azure Resources: Azure App Service: Create an App Service instance for your application. Azure Container Registry (ACR): Create a registry for storing your application’s container image. Prepare Your GitHub Repository: Ensure your Spring Boot application source code is in a GitHub repository. Include a Dockerfile in your project for containerization (see Step 2). Install Azure CLI: Download and install Azure CLI . Log in to Azure: az login Enable Admin User in ACR: Go to the Azure portal > ACR > Settings > Access Keys. Enable Admin user and note down the username and password . Step 2: Add a Dockerfile Navigate to the root of your Spring Boot application project. Create a Dockerfile with the following content: FROM eclipse-temurin: 17 -jdk-a...