👋 Hi Everyone, Today, I explored one of the powerful features of Spring Boot — Interceptors. They allow us to perform actions before and after a request is handled by a controller, making them ideal for logging, authentication, or performance monitoring. 💡 Concept Covered: Created a custom LoggingInterceptor to log incoming requests. Configured it using InterceptorConfig to apply globally across endpoints. Understood the methods: preHandle() → Executes before controller logic postHandle() → Executes after controller logic but before the view afterCompletion() → Executes after the request is fully completed 🧠 This helped me understand how to handle cross-cutting concerns cleanly within a Spring Boot application. 👉 Check out the interceptor implementation here: https://lnkd.in/gBxe8UiZ 📌 That’s all for today’s post. Stay tuned for the next topic in the Spring Boot series! 🚀 #SpringBoot #Interceptor #Java #SpringMVC #GitHub #SpringBootSeries #Learning #BackendDevelopment
"Exploring Spring Boot Interceptors for Logging and Monitoring"
More Relevant Posts
-
🧠 Thread vs ThreadPool — The Hidden Performance Difference Ever created a new thread for every task? It works… until it doesn’t. 🧵 Threads Each thread = its own memory Creating hundreds can kill performance. ✅ Fine for simple, one-off tasks ❌ Not scalable for high-load systems 🏊♂️ ThreadPool (ExecutorService) Instead of creating new threads, it reuses a pool of them. Tasks queue up, and free threads pick them up. ✅ Efficient, scalable, and avoids resource exhaustion 💡 Example: ExecutorService pool = Executors.newFixedThreadPool(10); pool.submit(() -> doWork()); ⚙️ The magic: Spring Boot, Tomcat, and even modern async frameworks use thread pools internally to handle concurrent requests efficiently. 💬 What’s your go-to strategy for managing concurrency? #Java #SpringBoot #Concurrency #Multithreading #SystemDesign #BackendDevelopment #PerformanceEngineering
To view or add a comment, sign in
-
Using Spring Boot? 🚀 Spring Boot 4 brings support for Jackson 3. In short: A safer, more modern JsonMapper. Cleaner code (fewer mandatory try-catch blocks). Smarter API calls (better control over the data you send). Dan Vega explains it with code in this video 👇 🔗 Link: https://lnkd.in/dEJsQDX5 #Java #SpringFramework #SpringBoot #Backend #JSON #API
Jackson 3 Support is HERE: What's New in Spring Framework 7 & Spring Boot 4
https://www.youtube.com/
To view or add a comment, sign in
-
Spring Boot injection: why constructors win When wiring dependencies in Spring Boot, constructor injection consistently beats field injection. Why it matters Immutability: collaborators can be final, reducing accidental mutation. Testability: easy to pass fakes/mocks without Spring context. Clarity: dependencies are explicit at object creation. @RequiredArgsConstructor @Service public class InvoiceService { private final PaymentClient paymentClient; private final InvoiceRepo repo; } Pro tips Use @RequiredArgsConstructor (Lombok) or write constructors yourself. Keep constructors small; if there are too many params, you likely need to split responsibilities. Pair with @ConfigurationProperties instead of sprinkling @Value. #Java #SpringBoot #CleanCode #Testing #OOP
To view or add a comment, sign in
-
🚀 Spring Boot 4 brings Jackson 3 support, and the changes are worth your attention. In my latest tutorial, I walk through the practical implications of this upgrade while building a donut shop API (because who doesn't love donuts?). The key shift? Moving from the mutable ObjectMapper to the new immutable JsonMapper. What really stands out: • Jackson 2 and 3 run side by side for compatibility, so your existing code won't break • The new JsonMapper uses an immutable builder pattern for thread-safe configuration • Unchecked exceptions replace checked ones, making Lambda expressions much cleaner • Date serialization now defaults to ISO strings instead of timestamps • JSON views give you precise control over what gets serialized The collaboration between the Spring and Jackson teams really shows here. They've managed package changes smoothly (tools.jackson vs com.fasterxml.jackson) while maintaining backward compatibility through shared annotations. Full demo with code examples: https://lnkd.in/ezPdmVCM Have you started exploring Spring Boot 4's release candidates? What features are you most excited about? #SpringBoot #Java #SpringFramework #SoftwareDevelopment #Programming #JavaDevelopment #BackendDevelopment
Jackson 3 Support is HERE: What's New in Spring Framework 7 & Spring Boot 4
https://www.youtube.com/
To view or add a comment, sign in
-
Spring Boot 4 brings Jackson 3 support, and with 2 and 3 run side by side for compatibility, so your existing code won't break
🚀 Spring Boot 4 brings Jackson 3 support, and the changes are worth your attention. In my latest tutorial, I walk through the practical implications of this upgrade while building a donut shop API (because who doesn't love donuts?). The key shift? Moving from the mutable ObjectMapper to the new immutable JsonMapper. What really stands out: • Jackson 2 and 3 run side by side for compatibility, so your existing code won't break • The new JsonMapper uses an immutable builder pattern for thread-safe configuration • Unchecked exceptions replace checked ones, making Lambda expressions much cleaner • Date serialization now defaults to ISO strings instead of timestamps • JSON views give you precise control over what gets serialized The collaboration between the Spring and Jackson teams really shows here. They've managed package changes smoothly (tools.jackson vs com.fasterxml.jackson) while maintaining backward compatibility through shared annotations. Full demo with code examples: https://lnkd.in/ezPdmVCM Have you started exploring Spring Boot 4's release candidates? What features are you most excited about? #SpringBoot #Java #SpringFramework #SoftwareDevelopment #Programming #JavaDevelopment #BackendDevelopment
Jackson 3 Support is HERE: What's New in Spring Framework 7 & Spring Boot 4
https://www.youtube.com/
To view or add a comment, sign in
-
Today I learned something interesting about Spring Boot’s @Async annotation. I was debugging why an async method wasn’t actually running in parallel — and eventually realized it was because I was calling it from within the same class. Since the call never went through the Spring proxy, the @Async behavior didn’t trigger. Lesson: @Async only works when the method is invoked through a Spring-managed proxy — not via direct internal calls within the same bean. Moving the method to a separate service (or injecting the bean itself via a proxy) fixed it instantly. A small reminder that many “magic” framework features are really just smart proxies under the hood — and understanding how they work can save hours of debugging. Have you ever run into similar proxy or async surprises in Spring Boot? #TodayILearned #SpringBoot #Java #Microservices #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
Today I ran into one of those bugs that reminds you how even the tiniest detail in an API integration can cause hours of debugging. I had a Spring Boot endpoint that required an api_key header. My client was 100% sending it. My controller was 100% expecting it. And yet… every request failed with: “400 – Required request header ‘api_key’ is not present.” After going through the usual suspects (typos, casing, request builder issues, etc.), I discovered the real culprit: ✅ NGINX silently drops headers containing underscores by default. So even though my Java code added the header correctly, it never made it past the gateway. The fix was simple: ✔️ Rename the header to api-key or x-api-key OR ✔️ Enable underscores_in_headers on; in NGINX (if you really must keep it) A small detail… but a powerful reminder of how infrastructure layers can impact API behavior in ways you don’t always expect. Sharing this in case it saves someone else the headache. #softwareengineering #springboot #nginx #apis #webdevelopment #codingtips #developerlife #backenddevelopment #programmingissues #devcommunity #java
To view or add a comment, sign in
-
-
I've always been curious about how large-scale systems handle millions of requests without crumbling. That curiosity led me down the rabbit hole of caching. 🐇 To put theory into practice, I built my own caching proxy server from scratch using Java and Spring Boot. It's a lightweight service that sits in front of any backend, intercepts GET requests, and caches the responses. The goal is to drastically reduce latency for users and ease the load on the primary server. Some of the results I was able to achieve: - Reduced API latency by up to 80%. - Decreased origin server load by 60%. - Achieved a 95% cache hit ratio in stress-test scenarios. I also containerized it with Docker for easy deployment. Building this was a fantastic learning experience in concurrency, REST API design, and system performance. If you're interested in the code or the implementation details, you can find the project on my GitHub : https://lnkd.in/g9PyF6-R #Java #SpringBoot #Backend #Caching #Performance #Docker #Maven #Scalability
To view or add a comment, sign in
-
🔐 Day 17 of My Java Full Stack Journey Encapsulation in Action — Controlling Access Like a Pro ⚙️ I learned that Encapsulation is about protecting data. And I explored how that protection actually works — through getters and setters. In Java, we keep variables private but expose public methods to access or update them safely. It’s like having a gatekeeper for your code — they decide what gets in, how, and when. 🛡️ Getter → reads the data (safe viewing) 👀 Setter → updates the data (with control) ✍️ This simple design principle keeps applications secure and clean — reminding me that good programming is not just about writing code, but about managing control. 💡 #Day17 #JavaDeveloper #FullStackJourney #Encapsulation #GettersAndSetters #OOPConcepts
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