创建四个项目
下载项目地址:
https://download.csdn.net/download/han_xiaoxue/10957427
消费者项目
dubbo-consumer.xml
生产者项目
dubbo-provider.xml
DubboProvider
public class DubboProvider {
private static final Log log = LogFactory.getLog(DubboProvider.class);
public static void main(String[] args) {
try {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
context.start();
} catch (Exception e) {
log.error("== DubboProvider context start error:",e);
}
synchronized (DubboProvider.class) {
while (true) {
try {
DubboProvider.class.wait();
} catch (InterruptedException e) {
log.error("== synchronized error:",e);
}
}
}
}
}
运行
启动zookeper
https://blog.csdn.net/han_xiaoxue/article/details/86747509
1、运行 DubboProvider 里的main方法,启动生产者项目
2、tomcat中启动 消费者项目
3、访问结果
用户名输入为空的时候,点击登录 会调用服务接口 查询出某表的条数。显示到下方。
!
!
成功!
!
!