Skip to main content

Posts

Showing posts from June, 2019

Inside spring framework from source code (2)

The most simple usage of Spring is to load xml definitions beans and use it. We will go through the whole work flow based on spring unittest. Go and check XmlBeanDefinitionReaderTests from package org.springframework.beans.factory.xml, The method "withImport" show the simple workflow to load beans. Let’s jump inside loadBeanDefinitions. The overview workflow is compromised by 3 steps as following:   Validate Mode for resource. The first main part is validate mode for resource. As we know, XML had 2 type of validation: DTD VS XSD. The first step is check the file content to detect which mode we will parse the XML file. Load document   Convert the input stream to xml document. Register Bean Definition CreateDelegate: Return BeanDefinitaionParseDelegate class.   The actual implement class which parse the xml content and create Spring bean. Before parse the actual bean, checking the profile at first. The working