1. 研究IOC首先創(chuàng)建一個簡單的web項目,在web.xml中我們都會加上這么一句

iOS培訓,Swift培訓,蘋果開發(fā)培訓,移動開發(fā)培訓

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

iOS培訓,Swift培訓,蘋果開發(fā)培訓,移動開發(fā)培訓

這代表了web容器啟動的時候會首先進入ContextLoaderListener這個類,并且之后會去加載classpath下的applicationContext.xml文件。那么重點就在ContextLoaderListener上,點開源碼:

iOS培訓,Swift培訓,蘋果開發(fā)培訓,移動開發(fā)培訓

/**
     * Initialize the root web appli
        
		

網友評論