I am learning Spring Framework. I have started with the core. I learn't the way to create Beans by specifying values in the XML file and then using Context (XML or Application) to initialize the bean. I am confused with this approach of creating objects via XML file (specifying value of constructors and setters method).
I feel my area of thinking is small. How Spring is helpful if I am creating a bean based on the values provided by user (through some fields)? I think in such scenarios, first I have to save those values in XML file and then initialize the bean via java code to get the object (If I am using spring framework).
My question is what is the benefit of having constructors initialized via XML file? In a basic java web application, I will create a bean based on the values provided by user (form fields) directly. I will never create an XML file (Spring Configuration), saving user input in that file then further initializing bean through Spring Context.
I hope I am able to explain my problem.
I can understand the benefit of DI and IOC but If anyone can explain me with a simple java example of a small program, where you are taking user input and saving it in DB (no need to write in detail code). How you will use the Constructor Injection or Setter Injection. The values provided by user are run time values.