国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Spring框架的啟動入口 ContextLoaderListener

2019-11-06 08:19:57
字體:
來源:轉載
供稿:網友

SPRing的入口配置在web.xml中。以監聽器的形式來實現。

	<listener>		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>	</listener>	<!-- 指定Spring Bean的配置文件所在目錄。默認配置在WEB-INF目錄下 -->	<context-param>		<param-name>contextConfigLocation</param-name>		<param-value>			classpath:config/applicationContext.xml			<!-- classpath:config/applicationContext-security.xml  -->		</param-value>	</context-param>

ContextLoaderListener實現了接口ServletContextListener,也就是說他必須實現contextDestroyed, contextInitialized這兩個方法

public class ContextLoaderListener extends ContextLoader implements ServletContextListener {		public ContextLoaderListener() {	}		public ContextLoaderListener(WebApplicationContext context) {		super(context);	}	/**	 * Initialize the root web application context.	 */	@Override	public void contextInitialized(ServletContextEvent event) {		initWebApplicationContext(event.getServletContext());	}	/**	 * Close the root web application context.	 */	@Override	public void contextDestroyed(ServletContextEvent event) {		closeWebApplicationContext(event.getServletContext());		ContextCleanupListener.cleanupAttributes(event.getServletContext());	}}

這個入口非常簡單,所有實現都隱藏在ContextLoader類里。

參考: http://solodu.iteye.com/blog/695980


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平凉市| 鹤庆县| 江都市| 浦城县| 象州县| 安平县| 永胜县| 绍兴市| 康平县| 正宁县| 咸宁市| 南通市| 义马市| 信阳市| 余庆县| 扶绥县| 襄汾县| 绥中县| 江达县| 万宁市| 二连浩特市| 金塔县| 高安市| 东源县| 南宫市| 翁牛特旗| 闻喜县| 亳州市| 亚东县| 开封县| 庐江县| 邵阳市| 泰宁县| 阿荣旗| 蒲城县| 苍山县| 庆云县| 大冶市| 武穴市| 原阳县| 赣州市|