🚀 Filter vs Interceptor in Spring Boot — With Code (No More Confusion!) Many developers know the theory… but struggle in real projects. Let’s make it crystal clear 👇 🔹 Filter (Servlet Level) 👉 Runs before DispatcherServlet 👉 Applies to ALL requests 💡 Use for: Logging, JWT extraction, CORS 🧩 Example: JwtFilter @Component public class JwtFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; String token = req.getHeader("Authorization"); if (token != null && token.startsWith("Bearer ")) { System.out.println("Filter → JWT Found"); } chain.doFilter(request, response); } } 🔹 Interceptor (Spring MVC Level) 👉 Runs before Controller 👉 Applies to specific APIs 💡 Use for: Authorization, validation, business logic 🧩 Example: HandlerInterceptor @Component public class JwtInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String token = request.getHeader("Authorization"); if (token == null) { response.setStatus(401); return false; } System. out.println("Interceptor → Authorized"); return true; } } 🧩 Register Interceptor @Configuration public class WebConfig implements WebMvcConfigurer { @Autowired private JwtInterceptor interceptor; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(interceptor) .addPathPatterns("/api/**"); } } ⚡ Execution Flow Request → Filter → DispatcherServlet → Interceptor → Controller 🔥 Golden Rule ✔ Filter = Global processing ✔ Interceptor = Controller-level logic 💡 Real-world usage Filter → Extract JWT Interceptor → Validate roles 👉 This is how clean microservices are built. 💬 Are you using Filter or Interceptor for authentication? #Java #SpringBoot #Microservices #Backend #Developers #Coding
Spring Boot Filter vs Interceptor with Code Examples
More Relevant Posts
-
1. Spring Boot (Regular http): The Imperative Model Traditionally, Spring Boot (using Spring MVC) followed a thread-per-request model. If a request needed to wait for a database, that thread stayed blocked and "expensive." @Async: This is a way to offload specific tasks to a background thread pool. It’s "fire-and-forget" or requires a CompletableFuture. It's great for side tasks (like sending an email) but doesn't change the fundamental nature of the web request. Virtual Threads (The Game Changer): Available since Java 21, you can now enable spring.threads.virtual.enabled=true. This allows Spring Boot to handle thousands of concurrent requests using lightweight threads that don't "block" the underlying OS thread. 2. Spring Boot WebFlux: The Reactive Model WebFlux is built on Project Reactor and uses an Event Loop (similar to Node.js). It doesn't use many threads; instead, it uses a small number of "worker" threads that never wait. Non-Blocking I/O: Every operation must be non-blocking. If you use a blocking JDBC driver inside WebFlux, you destroy its performance. Backpressure: This is the killer feature. If a client is too slow to receive data, WebFlux can signal the data source to slow down, preventing memory overflows. 4. When to Use Which? Choose Spring Boot (@Async / Virtual Threads) if: You are building a standard REST API or CRUD application. You rely on JPA/Hibernate or traditional JDBC. Your team wants code that is easy to write, read, and debug. Recommendation: This is now the "default" choice for 90% of business applications in 2026. Choose Spring WebFlux if: You are building a Streaming Service (e.g., live tickers, chat, or large file uploads). You need to maintain tens of thousands of concurrent connections (like WebSockets or SSE) on minimal hardware. You are building an API Gateway or a proxy that just passes data through. You have a fully reactive stack from the database (R2DBC) to the client. The "Hybrid" Verdict In modern architecture, many teams use Spring Boot with Virtual Threads for their main business logic (where readability matters) and WebFlux only for specific "edge" services that require high-throughput streaming. #SpringBoot #Java #Webflux #Reactive
To view or add a comment, sign in
-
-
🔹Mastering the Flow of Spring MVC:- The Spring MVC framework is one of the most widely used modules in the Spring ecosystem for building web applications. To truly master it, it's important to understand how the code flows behind the scenes. 1. Request Flow Begins (Client → Server) When a user sends a request (via browser or API), it first reaches the DispatcherServlet, which acts as the Front Controller in Spring MVC. It is responsible for: 1.Receiving all incoming requests 2.Deciding which controller should handle them 2. Handler Mapping (Finding the Right Controller) The DispatcherServlet consults Handler Mapping to identify the correct controller method based on: 1.URL pattern 2.HTTP method (GET, POST, etc.) Example: /login → LoginController → login() method 3. Controller Handles the Request The controller processes the request: 1.Accepts input data (form data, query params, JSON, etc.) 2.Calls the business logic (Service layer) 3.Prepares the response Controllers are annotated with: @Controller or @RestController 4. Business Logic (Service Layer) The controller delegates work to the Service layer, where actual logic is written. Responsibilities: 1.Processing data 2.Applying business rules 3.Interacting with repositories/DAO 5. Data Access (DAO / Repository Layer) If needed, the service communicates with the database through: 1.Repository or DAO classes 2.Uses technologies like JPA, Hibernate 6. Model Creation The controller adds data to a Model object, which will be used to render the view. Example: model.addAttribute("user", userData); 7. View Resolution The controller returns a logical view name (like "home"), and the View Resolver maps it to an actual page: 1.JSP 2.Thymeleaf 3.HTML 8. Response Sent Back Finally, the rendered view (or JSON response in REST APIs) is sent back to the client. #SpringMVC #SpringFramework #JavaDeveloper #BackendDevelopment #WebDevelopment #SoftwareDevelopment #Java #MVC #SoftwareArchitecture #Coding #DeveloperCommunity #TechSkills #Codegnan Anand Kumar Buddarapu Uppugundla Sairam Saketh Kallepu
To view or add a comment, sign in
-
🚀 RestTemplate vs RestClient vs WebClient vs Feign Client — Which one should YOU use in 2025? If you're a Java/Spring developer, you've definitely faced this confusion. Let me break it down once and for all. 🧵👇 ───────────────────────────── 📌 1. RestTemplate — The OG (Legacy) ───────────────────────────── ✅ Synchronous & blocking ✅ Simple to use, works out of the box ✅ Part of Spring since day one ❌ Deprecated in Spring 6+ ❌ Not suitable for high-throughput apps ❌ One thread per request — kills scalability 📦 Use it only if: You're maintaining old Spring Boot 2.x code. ───────────────────────────── 📌 2. RestClient — The Modern Replacement (Spring 6.1+) ───────────────────────────── ✅ Synchronous like RestTemplate but fluent API ✅ Cleaner, readable, builder-style syntax ✅ Official replacement of RestTemplate ✅ No reactive learning curve ❌ Still blocking — not for reactive apps 💡 Code: RestClient.create() .get() .uri("https://lnkd.in/gs9Ws-R6") .retrieve() .body(User.class); 📦 Use it when: You want modern code but don't need reactive. ───────────────────────────── 📌 3. WebClient — The Reactive Powerhouse ───────────────────────────── ✅ Non-blocking & asynchronous (Project Reactor) ✅ Handles thousands of concurrent requests ✅ Supports Mono<> and Flux<> streams ✅ Best for microservices with high load ❌ Steeper learning curve ❌ Overkill for simple CRUD apps 💡 Code: webClient.get() .uri("/users/{id}", 1) .retrieve() .bodyToMono(User.class) .subscribe(System.out::println); 📦 Use it when: Building reactive microservices or high-concurrency systems. ───────────────────────────── 📌 4. Feign Client — The Declarative King ───────────────────────────── ✅ Zero boilerplate — just write an interface ✅ Integrates perfectly with Spring Cloud ✅ Built-in load balancing with Eureka ✅ Supports fallback via Resilience4j ❌ Less control over raw HTTP behavior ❌ Harder to debug at times 💡 Code: @FeignClient(name = "user-service") public interface UserClient { @GetMapping("/users/{id}") User getUser(@PathVariable Long id); } 📦 Use it when: Building microservices with service discovery. ───────────────────────────── 🎯 QUICK DECISION CHART ───────────────────────────── 🟥 Legacy project (Boot 2.x) → RestTemplate 🟨 New project, no reactive needed → RestClient 🟩 High concurrency / reactive → WebClient 🟦 Microservices + service discovery → Feign Client ───────────────────────────── 💬 My Take as a Developer: ───────────────────────────── In 2025, if you're starting fresh: → Simple service? Go RestClient. → Microservices ecosystem? Go Feign. → Reactive architecture? Go WebClient. RestTemplate had a great run. Time to move on. 👋 ───────────────────────────── Drop a 🔥 if this helped you! Share with your team — someone needs to see this today. Follow me for more Spring Boot, Java & Backend deep dives every week! 🙌 #Java #SpringBoot #SpringFramework #WebClient #FeignClient #RestTemplate #RestClient
To view or add a comment, sign in
-
**Adopting Quarkus after years of Spring Boot** After years working with Spring Boot, I recently started using Quarkus on real projects. Not just hype. The shift is deeper and architectural. At first glance, both solve the same problems: REST, DI, persistence, security, cloud. But the real difference is not features. It’s when errors appear and how predictable the system is. Spring Boot is flexible and runtime-driven (auto-config, scanning, reflection). You move fast, but some issues appear late (integration or prod). Quarkus flips the model: build-time first, fail fast, less implicit behavior, more deterministic system. It validates early: • injection • configuration • wiring • integrations Result: less runtime logic, fewer surprises. --- **Build-time vs runtime (real impact)** Spring → validates late Quarkus → validates early In practice: • missing config → build error • invalid JPA mapping → early detection • ambiguous injection → build fails Dev loop changes completely. Spring: fast start, delayed issues Quarkus: stricter start, immediate feedback --- **Minimal example** Spring Boot: @Service class PaymentServiceV1 {} @Service class PaymentServiceV2 {} @Autowired PaymentService service → app starts → ambiguity handled later Quarkus: @ApplicationScoped @Named("v1") class PaymentServiceV1 {} @ApplicationScoped @Named("v2") class PaymentServiceV2 {} @Inject PaymentService service → build fails immediately Fix: @Inject @Named("v1") PaymentService service Same feature: Spring tolerates Quarkus enforces --- **What changes in practice** • clearer dependencies • fewer hidden bugs • faster debugging • more stable production At first: more friction Then: more control --- **Architecture impact** Spring: • runtime-heavy • implicit behavior • strong ecosystem Quarkus: • deterministic • explicit wiring • reduced reflection (native friendly) --- **Execution model** Spring (MVC): • blocking • 1 thread per request Quarkus: • reactive + non-blocking (Vert.x) • better scalability if used correctly But: blocking code in non-blocking flow = performance issues --- **Persistence** Both use Hibernate. Spring: • repository pattern • flexible Quarkus (Panache): • less boilerplate • faster for simple CRUD • needs discipline --- **Cloud & native** Spring = cloud compatible Quarkus = cloud-native by design • fast startup • low memory • native (GraalVM) ready --- **Reality check** Spring: • huge ecosystem • best for complex/legacy Quarkus: • more predictable • better for microservices But requires: • discipline • understanding of model --- **My takeaway** Not about performance. It’s about predictability. Less “why in prod?” More “I know why” --- Have you tried Quarkus in production? --- #Java #Quarkus #SpringBoot #Backend #SoftwareArchitecture #Microservices #CloudNative #GraalVM #TechLead #SoftwareEngineering
To view or add a comment, sign in
-
-
💼 𝐉𝐚𝐯𝐚 𝐁𝐚𝐜𝐤𝐞𝐧𝐝 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫 – 𝐌𝐲 𝐅𝟐𝐅 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐚𝐭 𝐏𝐮𝐧𝐞 𝐟𝐨𝐫 LTM 👉 This was my L1 (F2F) round. 🎯 𝐒𝐮𝐜𝐜𝐞𝐬𝐬𝐟𝐮𝐥𝐥𝐲 𝐜𝐥𝐞𝐚𝐫𝐞𝐝 𝐚𝐥𝐥 𝐫𝐨𝐮𝐧𝐝𝐬. 📌 2nd round was Technical (Online) – will share in next post 📌 Followed by Client round Karat interview experience – coming soon 𝐄𝐱𝐩𝐞𝐫𝐢𝐞𝐧𝐜𝐞: 𝟑-𝟓 𝐘𝐞𝐚𝐫𝐬 𝐓𝐞𝐜𝐡 𝐒𝐭𝐚𝐜𝐤: 𝐉𝐚𝐯𝐚, 𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭, 𝐌𝐢𝐜𝐫𝐨𝐬𝐞𝐫𝐯𝐢𝐜𝐞𝐬, 𝐒𝐐𝐋 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧𝐬 𝐀𝐬𝐤𝐞𝐝 1️⃣ Introduce yourself. 2️⃣ Have you implemented any new functionality recently? 3️⃣ Explain your project in brief. 4️⃣ Write program using 2 threads (Odd/Even printing). Output: 1,2,3,4,5... 5️⃣ Types of thread creation & why Runnable preferred? 6️⃣ Difference between Process & Thread? 7️⃣ What is Thread, Multithreading & Synchronization? 8️⃣ What is volatile, wait(), sleep(), notify(), notifyAll()? 9️⃣ What is thread-safe in Java? 🔟 Difference between @Bean & @Component? 1️⃣1️⃣ How to implement Entity relationship in Spring Boot? (code) 1️⃣2️⃣ Exception handling in Spring Boot? 1️⃣3️⃣ What is custom exception? Checked or Unchecked? 1️⃣4️⃣ How to create custom exception? 1️⃣5️⃣ Method Overloading vs Overriding (with example) 1️⃣6️⃣ Compile-time vs Runtime Exception 1️⃣7️⃣ If Compile-time exception → will project start? 1️⃣8️⃣ If Runtime exception → will project start? 1️⃣9️⃣ Check balanced brackets {[()]} 2️⃣0️⃣ Why functional interface? Why single method? 2️⃣1️⃣ Features of Java 8 (incl. memory aspects) 2️⃣2️⃣ What is profiling in Spring Boot? 2️⃣3️⃣ How to manage Spring profiles & check active profile? 2️⃣4️⃣ Filter employees age < 40 using Stream API 2️⃣5️⃣ How microservices communicate? 2️⃣6️⃣ Design patterns used in your project? 2️⃣7️⃣ How DB connects with Spring Boot? 2️⃣8️⃣ How to connect multiple DB in single service? 2️⃣9️⃣ Executor, ExecutorService, ScheduledExecutorService 3️⃣0️⃣ Internal working of HashMap? Collision handling? 3️⃣1️⃣ What is hashing in Java? 3️⃣2️⃣ How to write custom query in Spring Boot? If you're preparing for senior-level backend roles, these patterns are essential. 💼 𝑭𝒐𝒍𝒍𝒐𝒘 & 𝑪𝒐𝒏𝒏𝒆𝒄𝒕 🔗 For more Java, Spring Boot & Interview Prep content 🚀 👉 https://lnkd.in/dXeqv5Bf #Java #SpringBoot #Microservices #JavaDeveloper #BackendDeveloper #SQL #InterviewPreparation #CodingInterview #SystemDesign #TechCareer #LearningEveryday #SpringFramework #TechCommunity #Hiring #OpenToWork LTM L&T Technology Services Tata Consultancy Services Wipro Accenture Capgemini
To view or add a comment, sign in
-
🌱 Spring Boot Annotations Simplified! @SpringBootApplication This annotation marks the main class of a Spring Boot application, combining @Configuration, @EnableAutoConfiguration, and @ComponentScan. It serves as the entry point, enabling Spring Boot's auto-configuration and component scanning for seamless application setup. @Controller Identifying a class as a Spring MVC controller, this annotation handles HTTP requests, responding with the appropriate view or data. It plays a crucial role in web request processing. @RestController Similar to @Controller, this annotation is specifically designed for RESTful web services. Combining @Controller and @ResponseBody, it simplifies the development of RESTful APIs by automatically converting methods' return values to JSON or XML. @Request Mapping This annotation maps HTTP requests to handler methods within a controller. It specifies the URL patterns to handle and the methods to execute, providing a powerful way to define the requesthandling logic. @Autowired Used for automatic dependency injection, @Autowired reduces the need for manual bean wiring. Whether applied to a constructor, field, or method, it signals that Spring should inject the required dependency, promoting cleaner and more maintainable code. @Service Marking a class as a service, this annotation is typically used for encapsulating business logic. It aids in component scanning and code organization, helping to structure an application with a dedicated service layer. @Repository Identified as a Spring Data repository, this annotation allows a class to interact with a data source, handling database operations and exceptions translation. It simplifies data access in a Spring application. @Configuration Designating a class as a configuration class, this annotation defines application beans, replacing XML configuration with Java-based configuration. It plays a crucial role in configuring the Spring application context. @Component Serving as a generic stereotype annotation for any Spring-managed component, @Component marks a class as such, allowing it to be automatically detected and configured by Spring. It simplifies the process of declaring and managing Spring components. @Value This annotation injects values from properties files or environment variables into fields, providing a clean and concise way to handle external configuration. It simplifies the retrieval of configuration values within the application. #SpringBoot #JavaDevelopment #Programming #WebDevelopment #RESTfulAPI #Coding #SoftwareEngineering #TechInnovation #DeveloperCommunity #JavaProgramming #SoftwareDevelopment #SpringFramework #TechSkills #ProgrammingLife #CodeTips #JavaDevelopers #TechTalk #SoftwareArchitecture #Java
To view or add a comment, sign in
-
-
Day 28 — #100DaysOfJava ☕ Today a user typed something in a browser. My Java code received it, processed it, and sent a response back. That is client-server communication. And I built it from scratch. --- What I built today. A simple login form in HTML. User types username and password. Clicks submit. A Java Servlet receives that data on the server, reads it, and sends a response back to the browser. No framework. No Spring. No magic. Just raw Java talking directly to an HTTP request. --- How it actually works — and why every Spring Boot developer should understand this. The browser submits a form with method="post" to action="./firstServlet". The server sees that URL and maps it to my Servlet — because of this one annotation: @WebServlet("/firstServlet") That annotation replaced an entire XML configuration file. One line. Done. The Servlet extends HttpServlet and overrides two methods: doGet() — handles GET requests. When someone just visits the URL. doPost() — handles POST requests. When someone submits a form. Inside doPost(): String username = request.getParameter("username"); String password = request.getParameter("password"); PrintWriter writer = response.getWriter(); writer.print("Hello " + username); request.getParameter() reads the form field by its name attribute. PrintWriter writes the response back to the browser. That is the complete cycle. Request in. Process. Response out. --- What this taught me that no tutorial explains clearly. Every HTTP request has a method — GET or POST. GET is for fetching data. POST is for sending data. This is not just a Servlet concept. This is how the entire web works. Every form submission, every API call, every button click in a web app — underneath it is either a GET or a POST going to a server somewhere. Understanding this at the Servlet level means REST APIs, Spring Boot controllers, and API design all make immediate sense. @WebServlet maps a URL to a Java class. In Spring Boot, @RequestMapping and @GetMapping do the exact same thing — just with more features. Same concept. Different syntax. --- What Spring Boot does that raw Servlets do not. With raw Servlets — I write doGet() and doPost() manually. I configure the server. I handle everything. With Spring Boot — @RestController and @GetMapping handle all of this automatically. The Servlet container is embedded. Configuration is automatic. But here is the thing — Spring Boot is doing Servlet work underneath. It IS a Servlet application. Understanding the foundation means I will never be confused by what Spring Boot is doing for me. --- One thing I noticed in my own code today. I printed the password directly in the response: writer.print("I know your password " + password) Day 1 ... .......Day 28 To any developer reading this — what was the moment HTTP requests finally clicked for you? Drop it below. 👇 #Java #Servlets #HttpServlet #BackendDevelopment #WebDevelopment #100DaysOfJava #JavaDeveloper #LearningInPublic
To view or add a comment, sign in
-
🚀 Java Records in Spring Boot: Where They Actually Shine (and Where They Don’t) You’ve understood what records are. Now the real question is: Do you think you should use them in your backend APIs? Short answer: ✅ Yes — for most DTOs ❌ No — not everywhere Let’s break it down practically. 🧩 What are we talking about? Typical API request: POST /users { "name": "Tharun", "age": 26 } Traditional DTO: public class UserRequest { private String name; private int age; } With record: public record UserRequest(String name, int age) {} 🔥 Why Records are a great fit for APIs ✅ 1. Request data should be immutable A request is input, not a working object. With classes: request.setRole("ADMIN"); // accidental mutation With records: // impossible — no setters 👉 This enforces correctness by design. ✅ 2. Works seamlessly with Spring Boot Modern Spring Boot (2.6+ / 3.x): ✔ Supports records out of the box ✔ Uses Jackson to bind JSON → constructor @PostMapping public void createUser(@RequestBody UserRequest request) { System.out.println(request.name()); } 👉 No extra configuration needed. ✅ 3. Validation becomes cleaner public record UserRequest( @NotBlank String name, @Min(18) int age ) {} @PostMapping public void create(@Valid @RequestBody UserRequest request) {} 👉 Validation + immutability = safer APIs ✅ 4. Perfect for response DTOs public record UserResponse(String name, int age) {} 👉 Clear, predictable, no hidden state ⚠️ Where Records can hurt you This is where most devs misuse them 👇 ❌ 1. PATCH / partial updates { "name": "Tharun" } Problem: Missing fields → null Cannot distinguish: not sent explicitly null 👉 Records are too rigid here. ❌ 2. Mutable workflows If you need: dto.setName("A"); dto.setAge(25); 👉 Records cannot support step-by-step construction. ❌ 3. Complex transformations public void normalize() { this.name = name.trim().toLowerCase(); } 👉 Not possible — no mutation allowed. ❌ 4. JPA Entities (very important) @Entity public record User(...) {} // ❌ breaks Hibernate Why? No no-arg constructor No setters No proxy support 👉 Always use classes for entities. 🧠 Practical decision rule ✅ Use Records for: Request DTOs (simple POST/PUT) Response DTOs JPA projections Read-only data ❌ Use Classes for: Entities PATCH APIs Complex request flows Framework-heavy scenarios 💡 Advanced insight Records work best when your API follows: “Request = complete data snapshot” They struggle when your API needs: “Incremental/partial updates” 🚀 Final takeaway Records are the modern default for API DTOs But not a universal replacement for all classes If you use them correctly, you get: ✔ Cleaner code ✔ Safer APIs ✔ Fewer bugs ✔ Better readability Use them blindly, and you’ll hit limitations fast. #Java #JavaRecords #SpringBoot #BackendDevelopment #APIDesign #SystemDesign #SoftwareEngineering #JavaDeveloper #CleanCode #Programming
To view or add a comment, sign in
-
💼 𝐉𝐚𝐯𝐚 𝐁𝐚𝐜𝐤𝐞𝐧𝐝 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫 – 𝐋𝟐 𝐓𝐞𝐜𝐡𝐧𝐢𝐜𝐚𝐥 (𝐎𝐧𝐥𝐢𝐧𝐞 𝐅𝐄𝐁 𝟐𝟎, 𝟐𝟎𝟐𝟔) #𝐋𝐓𝐌 👉 This round focused on real-time scenarios + problem solving 📌 Questions were based on production issues & design thinking 📌 Next post → Client round experience 𝐄𝐱𝐩𝐞𝐫𝐢𝐞𝐧𝐜𝐞: 𝟑–𝟓 𝐘𝐞𝐚𝐫𝐬 𝐓𝐞𝐜𝐡 𝐒𝐭𝐚𝐜𝐤: 𝐉𝐚𝐯𝐚, 𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭, 𝐌𝐢𝐜𝐫𝐨𝐬𝐞𝐫𝐯𝐢𝐜𝐞𝐬, 𝐒𝐐𝐋 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧𝐬 𝐀𝐬𝐤𝐞𝐝 1️⃣ If API response time suddenly increased, how will you debug? 2️⃣ In case one microservice is down, then how will you handle fallback? 3️⃣ If duplicate records are getting inserted, then how do you find the root cause & fix it? 4️⃣ When there is a high DB load, then how do you optimize queries & indexing? 5️⃣ Scenario: Memory leak in production → how will you identify? 6️⃣ Write thread-safe caching mechanism (Java) 7️⃣ Group employees by dept & get max salary with Stream API 8️⃣ Remove duplicates & sort custom object with Stream API 9️⃣ Convert List<List<String>> → List<String> using flatMap 🔟 Write Spring Boot REST API with validation & exception handling 1️⃣1️⃣ Write down code to implement global exception handling 1️⃣2️⃣ Write JPA custom query (JPQL + Native) 1️⃣3️⃣ In case the transaction rollback is not happening, what will be the reason? 1️⃣4️⃣ Explain @Transactional propagation with use case. 1️⃣5️⃣ Design API for high concurrent users (rate limiting, caching) 1️⃣6️⃣ When multiple services are updating the same data, how do you handle data consistency? 1️⃣7️⃣ How will you implement Circuit Breaker in Spring Boot? 1️⃣8️⃣ Difference between Feign vs WebClient (which in high load?) 1️⃣9️⃣ Scenario: Need async processing → how to implement? 2️⃣0️⃣ ExecutorService use case in real-time project 💼 𝑭𝒐𝒍𝒍𝒐𝒘 & 𝑪𝒐𝒏𝒏𝒆𝒄𝒕 🔗 For more Java, Spring Boot & Interview Prep content 🚀 👉 https://lnkd.in/dXeqv5Bf #Java #SpringBoot #Microservices #JavaDeveloper #BackendDeveloper #SQL #InterviewPreparation #CodingInterview #SystemDesign #TechCareer #LearningEveryday #SpringFramework #TechCommunity Capgemini Infosys Tata Consultancy Services L&T Technology Services
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development