/**
* ��ʼ��components��
*/
private WebxComponentsImpl createComponents(WebxConfiguration parentConfiguration,
ConfigurableListableBeanFactory beanFactory) {
ComponentsConfig componentsConfig = getComponentsConfig(parentConfiguration);
// ����isAutoDiscoverComponents==true����ͼ�Զ�����components
Map<String, String> componentNamesAndLocations = findComponents(componentsConfig, getServletContext());
// ȡ���ر�ָ����components
Map<String, ComponentConfig> specifiedComponents = componentsConfig.getComponents();
// ʵ��Ҫ��ʼ����comonents��Ϊ����������Դ�IJ���
Set<String> componentNames = createTreeSet();
componentNames.addAll(componentNamesAndLocations.keySet());
componentNames.addAll(specifiedComponents.keySet());
// ����root controller
WebxRootController rootController = componentsConfig.getRootController();
if (rootController == null) {
rootController = (WebxRootController) BeanUtils.instantiateClass(componentsConfig.getRootControllerClass());
}
// ��������components��������resolvable dependencies���Ա�ע�뵽��Ҫ��bean��
WebxComponentsImpl components = new WebxComponentsImpl(componentsContext,
componentsConfig.getDefaultComponent(), rootController, parentConfiguration);
beanFactory.registerResolvableDependency(WebxComponents.class, components);
// ��ʼ��ÿ��component
for (String componentName : componentNames) {
ComponentConfig componentConfig = specifiedComponents.get(componentName);
String componentPath = null;
WebxController controller = null;
if (componentConfig != null) {
componentPath = componentConfig.getPath();
controller = componentConfig.getController();
}
if (controller == null) {
controller = (WebxController) BeanUtils.instantiateClass(componentsConfig.getDefaultControllerClass());
}
WebxComponentImpl component = new WebxComponentImpl(components, componentName, componentPath,
componentName.equals(componentsConfig.getDefaultComponent()), controller,
getWebxConfigurationName());
components.addComponent(component);
prepareComponent(component, componentNamesAndLocations.get(componentName));