1、通过IDEA生成SpringBoot项目
2、修改application.properties配置文件
[img]http://dl2.iteye.com/upload/attachment/0127/6343/1995b5db-87b1-3076-ba8f-3b461f8e1cd5.png[/img]
3、实现RPC接口(RPC接口定义在单独的项目中,如果不是需保证接口及其实现在相同的包下面)
注意:@Service和@Reference两个注解的引用路径
[img]http://dl2.iteye.com/upload/attachment/0127/6337/8010d4a1-cf56-3381-bfa8-cc785659dbe0.png[/img]
4、pom.xml导入
注意:spring-boot-starter依赖需要放在前面
2、修改application.properties配置文件
[img]http://dl2.iteye.com/upload/attachment/0127/6343/1995b5db-87b1-3076-ba8f-3b461f8e1cd5.png[/img]
3、实现RPC接口(RPC接口定义在单独的项目中,如果不是需保证接口及其实现在相同的包下面)
注意:@Service和@Reference两个注解的引用路径
[img]http://dl2.iteye.com/upload/attachment/0127/6337/8010d4a1-cf56-3381-bfa8-cc785659dbe0.png[/img]
4、pom.xml导入
注意:spring-boot-starter依赖需要放在前面
<properties>
<dubbo.version>2.8.4</dubbo.version>
<zkclient.version>0.10</zkclient.version>
<dubbo-spring-boot>1.0.0</dubbo-spring-boot>
<srvDefine.version>0.0.1-SNAPSHOT</srvDefine.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Spring Boot Dubbo 依赖 -->
<dependency>
<groupId>io.dubbo.springboot</groupId>
<artifactId>spring-boot-starter-dubbo</artifactId>
<version>${dubbo-spring-boot}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>${zkclient.version}</version>
</dependency>
<!-- Spring Boot Web 依赖 -->
<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>
<dependency>
<groupId>com.weyao</groupId>
<artifactId>srv-define</artifactId>
<version>${srvDefine.version}</version>
</dependency>
<!--最新版本,匹配spring Boot1.5 or higher-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>