現在直接來到我的觀點,如何在春季初始化應用程序?
在JSP
我會盡我的應用程序等的初始化過程,
<%! public void jsp_init(){
//Initialise the domain server to create protocol
//Create the logging file
}%>
我現在就把我以前的應用程序從重建到Servlets
Spring 3.2
。
我該怎麼做Spring 3.2
?
我的一個colleague
說我這樣做initialization with Constructor of the Spring Controller
。
因爲我已經在applicationContext.xml
創建的豆爲controller class
,我加載applicationContext.xml
文件枝條ContextLoadListner
在web.xml
。
這是初始化的正確方法嗎?
怎麼樣ApplicationListener在春天?
哪個是初始化應用程序的最佳方式spring 3.2
?
希望我們的堆棧用戶能給出一個很好的解決方案。
感謝您對答案的回覆。 http://stackoverflow.com/questions/8686507/how-to-add-a-hook-to-the-application-context-initialization-event –
@KitePlayer這也可以。這取決於您是否需要通知多種類型的應用程序事件或者只是啓動。 –
我需要做一些任務,只有一次在我的tomcat開始之後......對此最好的方法是什麼? –