Skip to content

Instantly share code, notes, and snippets.

@notyy
Last active November 2, 2016 13:05
Show Gist options
  • Save notyy/32e4aa58471401e55a3a912d75cf433e to your computer and use it in GitHub Desktop.
Save notyy/32e4aa58471401e55a3a912d75cf433e to your computer and use it in GitHub Desktop.
a dubbo sample
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.alibaba.dubbo.demo.UserService;
public class Consumer {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"http://10.20.160.198/wiki/display/dubbo/consumer.xml"});
context.start();
UserService userService = (UserService)context.getBean("userService"); // get remote proxy
String userId = UserService.createUser("sam newman"); // call remote method
System.out.println( userId ); // show result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment