package com.xxl.job.executor;

import com.alibaba.dubbo.common.utils.ConfigUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Properties;

/**
 * @author xuxueli 2018-10-28 00:38:13
 */
@SpringBootApplication
public class XxlJobExecutorApplication {

	public static void main(String[] args) {
		initZookeeperAddres(args);
		SpringApplication.run(XxlJobExecutorApplication.class, args);
	}

	/**
	 * 促使化dubbo注册中心的地址
	 * @param args
	 */
	private static void initZookeeperAddres(String[] args){
		if(args == null || args.length == 0){
			throw new RuntimeException("请传入zookeeper的地址");
		}
		String addres = "zookeeper://" + args[0];
		Properties properties = new Properties();
		properties.setProperty("dubbo.registry.address",addres);
		ConfigUtils.addProperties(properties);
	}

}