lotterywebservletcontextlistener.java.svn-base

来自「项目支付宝批量打款,采用httpclient+spring +quarz实现.」· SVN-BASE 代码 · 共 37 行

SVN-BASE
37
字号
package com.szhelper.pay;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class LotterywebServletContextListener implements ServletContextListener {
	private Log logger = LogFactory.getLog(LotterywebServletContextListener.class);


	public void contextInitialized(ServletContextEvent event) {
		this.initApplicationContext(event.getServletContext());

	}
    /**
     * init the ApplicationContextWrapper which wraper Spring application 
     * @param context
     */
	private void initApplicationContext(ServletContext context) {
		WebApplicationContext webContext = WebApplicationContextUtils
				.getWebApplicationContext(context);
		ApplicationContextWrapper wrapper = ApplicationContextWrapper
				.getInstance();
		wrapper.setApplicationContext(webContext);		
		logger.info("ApplicationContext has been initialized successfully.");
	}

	public void contextDestroyed(ServletContextEvent arg0) {		
		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?