提交 9ab4a62b 编写于 作者: S shenhongxi

MotanSwitcherRunner

上级 e58cd5c1
......@@ -14,9 +14,6 @@ public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
// 在使用注册中心时要主动调用下面代码
MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true);
System.out.println("server start...");
}
}
\ No newline at end of file
package com.weibo.motan.demo.service;
import com.weibo.api.motan.common.MotanConstants;
import com.weibo.api.motan.util.MotanSwitcherUtil;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* Created by shenhongxi on 2017/6/30.
*/
@Component
@Order(value = 1)
public class MotanSwitcherRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
// 在使用注册中心时要主动调用下面代码
MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true);
System.out.println("server start...");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册