WebContextListener代碼:
package com.fantastic;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletContext;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;
import org.springframework.web.context.ServletContextAware;
import com.alibaba.fastjson.JSONObject;
import com.fs.comm.mapper.SysParameterMapper;
import com.fs.comm.model.SysParameter;
import com.fs.web.service.SysParameterManagerService;
@Service
public class WebContextListener implements InitializingBean, ServletContextAware{
@Resource
private SysParameterMapper sysParameterMapper;
@Resource
private SysParameterManagerService sysParameterManagerService;
@Override
public void setServletContext(ServletContext servletContext) {
try {
// myServer.bind(1235);
// System.out.println("開機啓動一次-----------------------");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void afterPropertiesSet() throws Exception {
//開機後需要執行的業務邏輯
}
}