package com.excavator.rpc.boot;

import com.excavator.rpc.boot.service.SayService;
import com.excavator.rpc.boot.service.impl.SayServiceImpl;
import com.excavator.rpc.factory.ServerFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * Created by cmonkey on 3/29/17.
 */
@SpringBootApplication
public class SpringServerConfig {

    @Bean
    public SayService hello(){
        return new SayServiceImpl();
    }
    @Bean
    public ServerFactoryBean serverFactoryBean(){

        final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
        serverFactoryBean.setPort(9090);
        serverFactoryBean.setServiceInterface(SayService.class);
        serverFactoryBean.setServiceName("hello");
        serverFactoryBean.setServiceImpl(hello());
        serverFactoryBean.setZkConn("127.0.0.1:2181");

        new Thread(() -> {

            serverFactoryBean.start();;
        }, "RpcServer").start();

        return serverFactoryBean;
    }

    public static void main(String[] args){
        SpringApplication.run(SpringServerConfig.class, "--server.port=8082");
    }
}

@@ -187,16 +187,75 @@
 ryBean;%0A
+import org.springframework.beans.factory.annotation.Value;%0A
 import o
@@ -515,24 +515,150 @@
 erConfig %7B%0A%0A
+    @Value(%22$%7BzkConnection%7D%22)%0A    private String zkConnection;%0A%0A    @Value(%22$%7BserviceName%7D%22)%0A    private String serviceName;%0A%0A
     @Bean%0A  
@@ -677,21 +677,26 @@
 Service 
-hello
+sayService
 ()%7B%0A    
@@ -1023,15 +1023,19 @@
 ame(
-%22hello%22
+serviceName
 );%0A 
@@ -1078,13 +1078,18 @@
 mpl(
-hello
+sayService
 ());
@@ -1129,24 +1129,20 @@
 onn(
-%22127.0.0.1:2181%22
+zkConnection
 );%0A%0A

change get zkConnection