IoC and DI in Spring
IoC(Inversion of Control): Normally, in Java, we create references/variables by declaring them and then assigning a value to them or if reference by creating an object by calling its constructor with new. In this process, the total control of instantiating, configuring the variables/references(or)beans is with the developer. Instead, if this given to some other component, the task of providing the developer with objects meaning the task of creating objects is taken away from developer(can do if wishes to, but, won't be IoC), the normal process is inverted, hence called 'Inversion of Control'. Now, in Spring, this is done by IoC Container- ApplicationContext . The Spring Container is responsible for instantiating, configuring and managing lifecycle of beans. Spring framework provides several implementations of ApplicationContext- ClassPathXmlApplicationContext, FileSystemXmlApplicationContext and WebApplicationContext(for web applications). DI (De