Thursday, 16 July 2026

Java, Microservices, SpringBoot Along with AI Concepts

MCP : 

MCP helps to build Modular, Secure and Future Proof AI Integrations. As AI systems connect more deeply with enterprise tools, data, and workflows, one requirement is becoming increasingly important:
The integration layer needs standardization.
That is where MCP (Model Context Protocol) becomes valuable.
MCP gives AI applications a structured way to connect with tools, APIs, data sources, file systems, and enterprise systems through a common protocol pattern.
From an architecture perspective, this matters because one of the biggest sources of complexity in AI projects is custom integration logic spread everywhere.
What makes MCP useful is the separation of concerns it brings:
→ Hosts and clients manage the AI application side
→ MCP servers expose tools, data, resources, and prompts
→ Backend systems continue to hold business logic and enterprise data
→ Model providers remain more interchangeable behind the interaction layer
This opens up multiple implementation patterns:
Basic client-server for simple integrations, multi-server for modularity, gateway patterns for centralized policy control, chained tools for multi-step automation, dynamic discovery for extensibility, and scoped context for stronger isolation and multi-tenant security.
My view is simple:
MCP is not just another protocol.
It is an architectural pattern for building modular, secure, and future-ready AI integrations.
That is why I believe MCP will become an important part of enterprise AI design over the next few years.


Interview Questions :


Production issue in kubernetes : 
=====================

Core Design Pattersn : 
================


Http Status Codes : 
=============


EKS + AKS + GKE CICD Pipeline
=========================


OAuth2 + JWT 
===========


N+1 Problem 
==========


HLD Vs LLD 
==========

Docker Vs Kubernetes :
=================

Docker Architecture :
===============


Kubernetes Commands : 
=================


Kafka 
=====


A simplified architecture looks like this:

📍 1. Delivery Partner App
The rider's app continuously sends GPS coordinates (latitude, longitude, timestamp, order ID, etc.) every few seconds.
⬇️
⚡ 2. Kafka
Instead of sending updates directly to every service, the app publishes them to a Kafka topic (for example, location-updates).
Kafka acts as a high-throughput event streaming platform capable of handling millions of events reliably.
⬇️
🔄 3. Stream Processing
Consumer services read these events and:
• Validate incoming locations
• Filter invalid or duplicate updates
• Enrich events with additional data
• Execute business logic
⬇️
⚡ 4. Fast Storage
The latest location is stored in a low-latency datastore such as Redis.
Keeping only the latest location in memory allows extremely fast reads.
⬇️
📱 5. Customer Application
The customer app continuously fetches (or subscribes to) the latest location and updates the rider's position on the map in real time.

💡 Why Kafka?

Kafka isn't used just because it's popular.

It's chosen because it solves real engineering problems.
✅ Handles millions of location updates per second
✅ Preserves event ordering within partitions
✅ Decouples producers from consumers
✅ Enables multiple downstream services to consume the same event stream independently
✅ Provides fault tolerance and horizontal scalability

🎯 Interview Insight

One thing I've learned is that interviewers rarely want to hear:
"Kafka is used for live tracking."
Instead, they want to understand why Kafka fits the problem.

They're looking for answers to questions like:
• Why stream events instead of making synchronous API calls?
• Why introduce a message broker?
• How are events processed after Kafka?
• Why use Redis for live location storage?
• How does the customer finally see the moving rider?

That's what separates knowing a technology from understanding a system.
System Design interviews aren't about memorizing tools.

They're about understanding why each component exists and how they work together to build scalable systems.


Securing the API's using JWT and Spring Security : 
=====================================
Building Secure APIs using Spring Security & JWT

A secure API is much more than checking a username and password. It's about ensuring every request is authenticated, authorized, traceable, and protected against common security threats.
Here are the key building blocks of a production-ready secure API:

1. Authentication – Verify Who the User Is

2. Authorization – Verify What the User Can Access
Authorization ensures users only access resources they are permitted to.
Examples:
👤 USER
-View Profile
-Update Own Profile

👨‍💼 ADMIN
-Manage Users
-Delete Accounts
-Access Reports

3. JWT – Stateless Authentication
- Instead of maintaining server-side sessions, JWT carries user information inside a signed token.
A JWT typically contains:
- User ID
- Roles / Authorities
- Expiration Time
- Issued Time
- Digital Signature

4. Secure Every Request
For each incoming request:
a. Extract JWT from the Authorization header
b. Validate the token signature
c. Check token expiration
d. Load user details
e. Verify user permissions
f. Store authentication in the Security Context
g. Allow access to protected APIs, Otherwise → Return 401 Unauthorized or 403 Forbidden

API-GATEWAY
=========






Thursday, 3 November 2022

SpringBoot

SpringBoot

  • SpringBoot Application : 

    • Pros & Cons : 

  • SpringBoot Application creation using spring.io : 

  • SpringBoot Application Annotations : 

                    @SpringBootApplication : 
                            @SpringBootConfiguration
                            @EnableAutoConfiguration
                            @ComponentScan
                        
  • SpringBoot Application RestApi representation : 

  • SpringBoot Application RestApi with SpringJpa with CRUD operations :

  • Create

  • Insert

  • Update

  • Delete

  • SpringBoot Application RestApi with JPA Repository with Relationships : 

  • One to many

  • Many to one 

  • Many to many

  • One to one



Spring boot Interview Based Questions

Annotations

@SpringBootApplication : will take care of everything

@SpringBootConfiguration : will take about the configurations

@EnableAutoConfiguration : it configures the classpath beans

@ComponentScan : will scan all the classes 

ex : adding mongo dependency in the pom but beans no need to specify, enable auto configuration will take care.


SpringBoot Console Application : 

    


Diff between SpringBootConfiguration vs EnableAutoConfiguration


@Sterotype :

@Service :

@Controller :

@Componet :


@ResponseBody :

@ResponseEntity :


@Lazy :

IOC vs Dependency Injection :

    Earlier we are provind the dependency injection in xml but after spring boot comes its easy to inject the bean using @Autowired.


Diff mvc and spring boot ::
                Springboot                                            SpringMVC
    ==> embeded server                                        ==> need to configure the server
    ==> embeded db                                                ==> need to configure the db
    ==> faster development                                     ==> takes time to develop
    ==> avoid boilerplate code                                

SpringProfiling : using Profile we can instantiate the bean to the particular env.

For dev env we can instantiate the few beans for production we can instantiation using spring profiling.


Retry mechanism : 

@EnableRetry is used to retry the springboot application. It will retry the calls when exception occurs.

@Retryable(value=RuntimeException.class)


What is the starter dependency of the Spring boot module : web starter, Test starter , Data JPA starter.

How can you configure the RestTemplate in Spring not springBoot : 
        ==> ApplicationContext ctx = new AnnotationConfigApplicationContext(RestTemplate.class)
                RestTemplate rs = ctx.getBean(RestTemplate.class);

How can you secure your api in Spring not SpringBoot(SpringWebFilter)
        @EnableWebSecurity and overrride the configure(HttpSecurity http) method

When the beans will destroy in SpringBoot : 

When the beans will initialize : By Starting the springboot tomcat server or applicaiton starting time.

Bean Life Cycle :    
            ==> ContainerStarted --> Bean instantiated --> Dependcies injected --> Init() -> destroy()
    
Spring Actuator Apis : 
            ==> Health check purpose 
            ==>  /health
            ==> / beans
            ==> /caches
            ==> /configProps
            ==> /env
What is thymeleaf?
   
Spring cloud config server : 

GraphQL : Graphql is a query language to retrive the data from servers. Its a alternative to SOAP and REST and GRPC. 
The main steps of creating a GraphQL Java server are:
  1. Defining a GraphQL Schema.
  2. Deciding on how the actual data for a query is fetched
GraphQL offers a solution to both of these problems. It allows the client to specify exactly what data it desires, including from navigating child resources in a single request, and allows for multiple queries in a single request.
It also works in a much more RPC manner, using named queries and mutations, instead of a standard mandatory set of actions. This works to put the control where it belongs, with the API developer specifying what's possible, and the API consumer specifying what's desired.

2 Piller of GraphQL : 
  1. GraphQL Schema
  2. GraphQL Query Language

Java, Microservices, SpringBoot Along with AI Concepts

MCP :  MCP helps to build Modular, Secure and Future Proof AI Integrations. As AI systems connect more deeply with enterprise tools, data, a...