浏览代码

RPc代码提交

chenweida 9 年之前
父节点
当前提交
1b42889afc

+ 1 - 0
Hos-Resource-Rest/src/main/java/com/yihu/hos/config/Config.java

@ -14,5 +14,6 @@ public class Config {
    public static String appId;
    public static String monogoUrl;
    public static String startCollect;
    public static String port;
}

+ 10 - 5
Hos-Resource-Rest/src/main/java/com/yihu/hos/resource/base/App.java

@ -31,6 +31,7 @@ import java.util.Set;
@EntityScan("com.yihu.hos.**.model")
public class App {
    private static Properties prop = new Properties();
    //@RequestMapping("/")
    //String home() {
    //    return "Hello World!";
@ -62,14 +63,16 @@ public class App {
        //SpringApplication.run(App.class, args);
        //启动RPC服务器
        Server server = Server.getInstance(8891);
        server.start();
        initConfig();
        readpop();
        Server server = Server.getInstance(Integer.valueOf(Config.port));
        server.start();
    }
    private static  void initConfig() {
    private static void initConfig() {
        try {
            InputStream in = App.class.getResourceAsStream("/config/dbhelper.properties");
            prop.load(in);
@ -78,9 +81,11 @@ public class App {
            e.printStackTrace();
        }
    }
    private static void readpop(){
        Config.url= prop.getProperty("rpc.url");
    private static void readpop() {
        Config.url = prop.getProperty("rpc.url");
        Config.appId = prop.getProperty("rpc.appId");
        Config.port = prop.getProperty("rpc.port");
        Config.monogoUrl = prop.getProperty("http.monogourl");
        Config.startCollect = prop.getProperty("http.startCollect");
    }

+ 1 - 0
Hos-Resource-Rest/src/main/resources/rpc.properties

@ -1,3 +1,4 @@
rpc.port=8081
rpc.url=172.18.20.123:8085
rpc.appId=EsbCloud