While loading the bean file IOC container will have SAX parsing. Bean file will be defined by the SAX parser. If any tags are invalid in the XML file then SAX will give a parsing exception at the time of loading.
The developer will configure bean definitions with bean id and bean class. By the request of the user only IOC container creates the instance of the bean with getBean () method. While the request of other users only same instance will be given to them also where the scope of the bean is a singleton.
Example of BeanFactory is as follows.
Resource resource=new ClassPathResource("applicationContext.xml"); BeanFactory factory=new XmlBeanFactory(resource);
In the scope of the prototype instance will not be created by IOC, if developer use prototype needs to create an instance for each user request.
Example of ApplicationContext Container as shown follows.
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");