1. 程式人生 > >三種Spring載入機制

三種Spring載入機制

方法一. 在main方法中啟動Spring

ApplicationContext ac = new XmlApplicationContext("applicationContext.xml");

 

方法二. 利用Spring自帶的Servlet啟動, 配置好Servlet, 載入Servlet的時候, 就初始化了WebApplicationContext

 

方法三. 利用Spring自帶的Listener啟動, 裝配好Listener, 載入Listener的時候, 就初始化了WebApplcaitionContext