IoC Container:
Its the generic term given to the container which manages the bean lifecycle in spring. The 2 implementations of IoC Container are- Bean Factory and Application Context.
What is IoC ? In java we inject the dependency of classes through below way:
class A{ B b=new B(); }
But if we write the code like below, then we are transferring the control of object creation from java to some other framework called Spring. This is Inversion Of Control.
class A{ @Autowired B b; }
Bean Factory:
BeanFactory is the root interface for accessing the Spring container. One of the popular implementation of BeanFactory interface is XMLBeanFactory.
BeanFactory uses lazy loading approach to load its bean.
Application Context:
ApplicationContext is also an interface that extends BeanFactory.
ApplicatonContext uses eager loading approach to load its bean, so wherever there is an issue of memory management like in mobile applications better to go with BeanFactory, else in Web applications we should use ApplicationContext.
In Java web application we use WebApplicationContext which extends ApplicationContext interface and adds getServletContext method to it.
One of the popular implementation of ApplicationContext interface is ClassPathXmlApplicationContext.
In traditional Spring we get the ApplicationContext object like this:
ApplicationContext context = new ClassPathXmlApplicationContext("applicationcontext/spring-config.xml");
In Spring boot we get the ApplicationContext object like this:
ConfigurableApplicationContext context = SpringApplication.run(MyApplication.class, args);