소스 검색

git-svn-id: https://192.168.57.71/svn/jsgkj@542 931142cf-59ea-a443-aa0e-51397b428577

xt_yuanxd 9 년 전
부모
커밋
2d09560139
2개의 변경된 파일45개의 추가작업 그리고 1개의 파일을 삭제
  1. 44 0
      xtdsp/trunk/src/main/java/com/xt/dsp/common/InitServlet.java
  2. 1 1
      xtdsp/trunk/src/main/webapp/WEB-INF/web.xml

+ 44 - 0
xtdsp/trunk/src/main/java/com/xt/dsp/common/InitServlet.java

@@ -0,0 +1,44 @@
+package com.xt.dsp.common;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
+import org.apache.log4j.Logger;
+import org.quartz.SchedulerException;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import com.xt.dsp.service.JobService;
+
+/**
+ * 系统初始化处理
+ * 
+ * @author 袁晓冬
+ */
+public class InitServlet extends HttpServlet {
+	protected Logger logger = Logger.getLogger(getClass());
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 系统初始化处理
+	 */
+	@Override
+	public void init() throws ServletException {
+		super.init();
+		System.err.println("----------System Init------------");
+		try {
+			initSchedule();
+		} catch (Exception e) {
+			System.err.println("系统初始化异常:" + e.getMessage());
+		}
+	}
+
+	private void initSchedule() throws SchedulerException {
+		WebApplicationContext wac = WebApplicationContextUtils
+				.getRequiredWebApplicationContext(this.getServletContext());
+		JobService jobService = wac.getBean(JobService.class);
+		// 启动
+		jobService.start();
+	}
+}

+ 1 - 1
xtdsp/trunk/src/main/webapp/WEB-INF/web.xml

@@ -67,7 +67,7 @@
 
 	<servlet>
 		<servlet-name>InitServlet</servlet-name>
-		<servlet-class>com.xt.dsp.system.InitServlet</servlet-class>
+		<servlet-class>com.xt.dsp.common.InitServlet</servlet-class>
 		<load-on-startup>99</load-on-startup>
 	</servlet>
 </web-app>