首页>代码>阿里巴巴SOA服务化治理方案的核心框架dubbo入门demo演示实例>/dubbo-demo/dubbo-consumer/src/main/java/TestDubboProvider.java
import com.github.zhaohonglin1995.dubbo.provider.api.ITestProvider; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * 描述:dubbo-Consumer调用方 * */ public class TestDubboProvider { public static void main(String[] args) { //开始调用 ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml"); ITestProvider iTestProvider=ctx.getBean(ITestProvider.class); //只负责调用这个接口方法,不需要关注具体实现 String str=iTestProvider.sayHi("dubbo"); System.out.println(str); } }