-
Java打包后的可执行脚本包括cmd、sh和spring
资源介绍
package generconfig;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
import org.springframework.context.support.GenericXmlApplicationContext;
import com.pactera.service.schedule.ThreadReadPath;
import com.pactera.util.CommTool;
/*打包用File->Export->runnable JAR File Export
Launch选择对应的类
Export destination 选择地址
Library handling:Copy required
*/
public class SMSThreadSender {
public static void main(String[] args) {
if(args.length==0)
{
System.out.println("短信服务开启,开始加载Spring配置。");
GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.setValidating(false);
context.load("classpath:sysconfig/applicationContext.xml");
context.refresh();
System.out.println("开整·~~~~");
CommTool.smsthreadisruning=true;
ThreadReadPath thread = new ThreadReadPath();
thread.smsname="sms"+CommTool.threadid;
Thread t1 = new Thread(thread);
t1.setName("sms");
t1.start();
System.out.println("已经启动");
}
if(args.length==1)
{
String pfile=args[0];
System.out.println("短信服务开启,开始加载Spring配置。"+pfile);
GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.setValidating(false);
context.load(pfile);
// context.load("classpath:sysconfig/applicationContext.xml");
context.refresh();
CommTool.smsthreadisruning=true;
ThreadReadPath thread = new ThreadReadPath();
thread.smsname="sms"+CommTool.threadid;
Thread t1 = new Thread(thread);
t1.setName("sms");
t1.start();
System.out.println("已经启动");
}
}
}