|
@@ -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();
|
|
|
+ }
|
|
|
+}
|