public interface GreetingService { String greet(String name); } public class GreetingServiceImpl implements GreetingService { @Override public String greet(String name) { return "Hello, " + name + "!"; } } public class GreetingClient { public static void main(String[] args) { RemotingOptions options = new RemotingOptions(); options.setHost("localhost"); options.setPort(8080); RemoteInvoker invoker = new RemoteInvoker(options); GreetingService service = invoker.create(GreetingService.class); String result = service.greet("Alice"); System.out.println(result); } }


上一篇:
下一篇:
切换中文