下载zookeeper
到config目录去把zookeeper_sample.cfg改名为zookeeper.cfg
修改bin目录下的zkEnv.cmd文件,set ZOOFG
启动,打开bin目录下的zkServer.cmd,如出现闪退,在zkServer加上pause
启动完成如下
下载dubbo-2.6.0
修改D:\dubbo\dubbo-dubbo-2.6.0\dubbo-admin\src\main\webapp\WEB-INF的dubbo.properties
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
dobbo admin安装
在cmd下找到D:\dubbo\dubbo-dubbo-2.6.0\dubbo-admin
打包完成之后D:\dubbo\dubbo-dubbo-2.6.0\dubbo-admin下就有了target这个文件夹
把dubbo-admin-2.6.0war复制到tomcat的webapps文件加下
tomcat的bin目录启动startup.bat
建个Maven项目
首先dobbo-api
entity
package com.dubbo.entity;
import java.io.Serializable;
public class People implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1415852192397895853L;
// 人员编号
private int id;
// 姓名
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "People [id=" + id + ", name=" + name + "]";
}
}
sevcie包
package com.dubbo.service;
import com.dubbo.entity.People;
public interface PeopleService {
People getPeople(People people);
}
启动文件
package com.dubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
@SpringBootApplication
@EnableDubbo
public class Start {
public static void main(String[] args) {
SpringApplication.run(Start.class, args);
}
}
application.properties
server.port=8887
pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pp</groupId>
<artifactId>dubbo-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.12.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba.boot/dubbo-spring-boot-project -->
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
</project>