Understanding HandlerInterceptor Order in Spring Boot When you register multiple HandlerInterceptors in a Spring Boot application, have you ever wondered which one runs first? Here’s how Spring decides the order: Unlike Filters (which use @Order), HandlerInterceptors run in the order they are registered inside your WebMvcConfigurer. #SpringBoot #Java #SoftwareEngineering #BackendDevelopment #SpringMVC #CleanArchitecture
Salman Saleem’s Post
More Relevant Posts
-
Spring Container & Component Scanning The Spring Container manages object creation, wiring, and bean lifecycle. It reads configuration metadata to build your application structure. Using @ComponentScan, Spring auto-detects beans in specified packages. Together, they enable clean, modular, and maintainable applications. #SpringFramework #Java #SoftwareEngineering #BackendDevelopment
To view or add a comment, sign in
-
BeanPostProcessor & BeanFactoryPostProcessor BeanPostProcessor allows custom logic after bean initialization. It helps modify bean instances right before use. BeanFactoryPostProcessor modifies bean definitions before creation. Useful for adjusting configuration metadata dynamically. Both provide powerful customization for advanced scenarios. #SpringFramework #Java #SoftwareEngineering #BackendDevelopment
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 — turns out, it was because I was calling it from the same class, so Spring’s proxy never intercepted the method call. Lesson: @Async only works when the method is called through the Spring proxy, not directly inside the same bean. Moving the method into a separate service (or injecting self via proxy) fixed the issue instantly. It’s a small reminder that framework features are just smart proxies under the hood — and understanding how they work saves hours of debugging. Have you hit similar proxy or async issues in Spring Boot? #TodayILearned #SpringBoot #Java #Microservices #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
Spring Profiles & Environment Spring Profiles allow environment-specific configurations like dev or prod. They load only the beans relevant to the active profile. The Environment interface helps access these active profiles. It also retrieves property values dynamically at runtime. Together they enable clean, flexible multi-environment setups. #SpringFramework #Java #SoftwareEngineering #BackendDevelopment
To view or add a comment, sign in
-
🚀 Built a thread-safe backend module in Spring Boot using Java’s ReentrantLock to handle concurrent device operations and license management. This project simulates real-world multi-user environments — ensuring accurate license usage, race-free execution, and consistent state even under heavy concurrency. It strengthened my hands-on expertise in: ✅ Java Concurrency & Multithreading ✅ Spring Boot Service Design ✅ Thread-Safe Resource Management ✅ Scalable System Architecture Always excited to work on backend challenges that blend performance, safety, and clean design 💻 For Details, see the comments. #JavaDeveloper #SpringBoot #Concurrency #BackendEngineering #ReentrantLock #ThreadSafety #JavaJobs #SystemDesign
To view or add a comment, sign in
-
-
⚙️ Bean Lifecycle in Spring Every Spring bean goes through stages like instantiation, dependency injection, initialization, and destruction. Developers can customize these steps using lifecycle annotations such as @PostConstruct and @PreDestroy. Spring automatically manages this entire lifecycle, ensuring optimal resource handling and clean object management. 🔁 #SpringBoot #SpringFramework #Java #SpringBeans #Lifecycle #BackendDevelopment
To view or add a comment, sign in
-
🔹 Spring Scopes in a Nutshell Session bean → Singleton dependency ✅ Each user gets their own session bean All share the same singleton Singleton → Session dependency ❌ Singleton can’t directly hold a session bean Spring injects a proxy (like a mailbox) When the singleton calls a method, the proxy delivers it to the correct session bean for the current user 💡 Analogy: Session → Singleton: each user has their notebook, everyone uses the same pen ✍️ Singleton → Session: singleton talks to a mailbox, which routes messages to the right notebook 📬 Mix scopes carefully — proxies make it safe! #SpringBoot #Java #SessionScope #Singleton #BackendEngineering #SpringTips
To view or add a comment, sign in
-
Why Every Spring Boot Developer Should Understand @Transactional Deeply Most of us use @Transactional daily — but few truly know what happens behind the scenes. Here’s the real story 1️⃣ When you mark a method with @Transactional, Spring creates a proxy around your bean. 2️⃣ This proxy manages the database connection and transaction context. 3️⃣ If the method finishes successfully → ✅ Transaction commits. 4️⃣ If a runtime exception occurs → 🔁 Spring rolls back automatically. ⚡ Pro Tips: Rollback doesn’t occur for checked exceptions unless explicitly configured. Self-invocation (calling another @Transactional method in the same class) → ❌ no new transaction triggered! Understanding this behaviour helps you avoid hidden bugs and build reliable, production-grade systems. #SpringBoot #Java #Microservices #BackendDevelopment #Transactional #SystemDesign #CodeQuality #Programming #Rajkumar
To view or add a comment, sign in
-
🌱 Bean Scopes in Spring Spring supports multiple bean scopes such as singleton, prototype, request, session, and application. The singleton scope creates one shared instance per container, while prototype generates a new instance each time. Web scopes like request and session manage user-specific data efficiently in web applications. 🌐 #SpringFramework #SpringBoot #Java #BackendDevelopment #BeanScopes
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
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