package cn.hhj; import cn.hhj.config.SpringConfig; import cn.hhj.proxy.RpcProxyClient; import cn.hhj.service.IHelloService; import cn.hhj.version.Version; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; public class RpcClientStart { public static void main( String[] args ) throws InterruptedException { ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class); RpcProxyClient rpcProxyClient = context.getBean(RpcProxyClient.class); IHelloService iHelloService = rpcProxyClient.getClientProxy(IHelloService.class, Version.V2); for (int i = 0; i < 100; i++) { Thread.sleep(2000); System.out.println(iHelloService.sayHello(i)); } } }