I dont get how appContext.getBean() is beneficial than creating the object using new.
Yeah, i read the line that says that it is useful when you have lot of components to be used.
But if the member objects are created internally in the constructor instead of passing as parameter, that issue is avoided. Tight coupling is avoided by use of interface and say I want to switch from ContentBasedFilter to CollaborativeFilter, how is moving the @Component annotation any better than changing the code to use the different class? Compilation and delivery of jars to the customer is needed in both the cases.
On the contrary, if I want to do something like read a config file and at runtime pick the right class, the @Component is useless, right?
Atleast at this moment, Spring looks like too much overengineering for little or no benefit which on the contrary is making things difficult to maintain and understand by introducing hidden “magic” to the code.
Course: https://www.educative.io/collection/5352985413550080/4785082259734528
Lesson: https://www.educative.io/collection/page/5352985413550080/4785082259734528/6005340081487872