Loose Coupling in Spring — No Source Code Change Implemented true loose coupling in Spring where the injected bean is controlled externally, not hard-coded. ✔ Bean selection done via properties file ✔ Dynamic alias mapping in XML ✔ Dependency injected using @Qualifier ✔ Switched engine implementation without touching Java code 💡 Just update the property value → restart → different bean gets injected. This cleanly separates configuration from logic and makes the app flexible and maintainable. #Spring #Java #DependencyInjection #LooseCoupling #BackendDevelopment #LearningInPublic #GeeksForGeeks160Days #Day103
Loose Coupling in Spring via External Bean Control
More Relevant Posts
-
Spring Bean Lifecycle: what’s often missed Most explanations of the Spring Bean lifecycle stop at @PostConstruct, but an important step comes after initialization. Key lifecycle phases: Bean instantiation & dependency injection Aware callbacks BeanPostProcessor (before initialization) Initialization (@PostConstruct) BeanPostProcessor (after initialization) ← AOP proxies created here Bean ready for use Destruction (@PreDestroy) Spring applies AOP using a BeanPostProcessor that wraps eligible beans with proxies after they are fully initialized. Understanding this explains: Why does the internal method call bypass @Transactional Why your bean reference is often a proxy How Spring adds cross-cutting concerns cleanly 💬 Did you know proxy creation happens after initialization? #SpringBoot #SpringFramework #BeanLifecycle #SpringAOP #Java #BackendDevelopment
To view or add a comment, sign in
-
💡 Var in Java: modern clarity or hidden complexity? Var was introduced to reduce noise, but using it casually can hurt readability. Here’s how I’ve learned to use it effectively: ✅ Use var when the type is immediately obvious. The variable name clearly communicates intent and boilerplate hides the actual business logic. var activeUsers = userService.findActiveUsers(); ❌ Avoid var when the return type isn’t obvious. Readers must infer or guess the type. var result = process(data); // unclear If a new team member can’t identify the type at a glance, don’t use var. Used wisely, var modernizes Java. Used casually, it slows teams down. #Java #Java17 #ModernJava #CleanCode #DeveloperExperience #BackendEngineering
To view or add a comment, sign in
-
#day12 #companySwitch #constructor A constructor in Java is a special member that is called when an object is created. It initializes the new object’s state. It is used to set default or user-defined values for the object's attributes a. A constructor has the same name as the class. b. It does not have a return type, not even void. c. It can accept parameters to initialize object properties. Types of Constructors in Java -: There are four types of constructors in Java 1. Default Constructor 2. Parameterized Constructor 3. Copy Constructor in Java 4. Private Constructor #leetcode #gfg #interviewbit #Consistency #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Virtual Threads Make Blocking Cheap (But Not Free) For years in Java backend development, blocking meant wasted threads, exhausted pools, and collapsed systems under load. With Project Loom (Java 21), that assumption is no longer true - but only if we understand what actually changed. In this article, we will discuss why blocking was expensive, how virtual threads changed the cost model, and where blocking is still dangerous with code examples. https://lnkd.in/g26KjUYc Subscribe and join 4.3k Java & Spring boot engineers: https://lnkd.in/gwiRqWBV
To view or add a comment, sign in
-
Virtual Threads Make Blocking Cheap (But Not Free) For years in Java backend development, blocking meant wasted threads, exhausted pools, and collapsed systems under load. With Project Loom (Java 21), that assumption is no longer true - but only if we understand what actually changed. In this article, we will discuss why blocking was expensive, how virtual threads changed the cost model, and where blocking is still dangerous with code examples. https://lnkd.in/gBKg-r_K Subscribe and join 4.3k Java & Spring boot engineers: https://lnkd.in/grH6HSuY
To view or add a comment, sign in
-
Hook If your Java service ever hangs during shutdown, the root cause is almost always unstructured background work — and that risk compounds as you introduce async code and legacy blocking libraries. Body Here is a concise, production-tested 3-step recipe to make Spring Boot apps on Java 21+ shut down reliably and predictably. Step 1 — Use a virtual-thread executor and manage its lifecycle. Use Executors.newVirtualThreadPerTaskExecutor
To view or add a comment, sign in
-
Hook: Thread pools are the silent performance killers in many Java backends—connection starvation and thread-pool exhaustion show up as 95th-percentile latency spikes that teams only see in production. Body: If you're running Spring Boot with blocking JDBC and classic fixed thread pools, Java 21 virtual threads give you a practical path to simplify concurrency and reduce tail latency. Virtual threads let each request use a cheap thread for blocking syscalls
To view or add a comment, sign in
-
🚀 Java Day 8 – Arrays (Revised & Coded) Today’s focus was on strengthening array fundamentals through hands-on Java implementations. I worked on the following problems: ✅ DuplicateFind – Identify duplicate elements ✅ IntersectionOfArrays – Find common elements between arrays ✅ PairSum – Check pairs with a given sum ✅ Sort01 – Efficiently sort 0s and 1s ✅ TripletSum – Find triplets matching a target sum ✅ UniqueFind – Identify the unique element 💡Code on github - https://lnkd.in/dFrPU2dU This session helped reinforce problem-solving skills, logic building, and efficient array handling in Java. 💡 On to more DSA practice and optimization! #Java #DSA #Arrays #CodingPractice #ProblemSolving #LearningJourney
To view or add a comment, sign in
-
Java is no longer the "verbose" language we used to joke about. With Java 25, the entry barrier has been smashed. Instance Main Methods: No more static. Just void main(). Flexible Constructors: You can now run logic before calling super(). Markdown in Javadoc: Finally, documentation that looks good without HTML hacks. Question for the comments: Are you team "Modern Java" or do you still prefer the classic boilerplate? 👇 #Java25 #SoftwareEngineering #CodingLife #BackendDevelopment #codexjava_ If you’re still writing Java like it’s 2011 (Java 7), you’re missing out on a 50% productivity boost.
To view or add a comment, sign in
-
-
Hook: A misconfigured thread pool can multiply tail latency by 5–20x under modest load. In profiling across several mid-sized services, moving blocking I/O to Java 21 virtual threads cut p95 by 30–60% and reduced peak native threads by 90% — but only when migrated with discipline. If you run latency-sensitive Java services, here’s a pragmatic 3-step migration
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