}
- 双击下图红框中的task即可生成java代码:
- 生成下图红框中的文件:
- 接下来开发服务端;
开发服务端应用
- 在父工程grpc-turtorials下面新建名为client-stream-server-side的模块,其build.gradle内容如下:
// 使用springboot插件
plugins {
id ‘org.springframework.boot’
}
dependencies {
implementation ‘org.projectlombok:lombok’
implementation ‘org.springframework.boot:spring-boot-starter’
// 作为gRPC服务提供方,需要用到此库
implementation ‘net.devh:grpc-server-spring-boot-starter’
// 依赖自动生成源码的工程
implementation project(’:grpc-lib’)
// annotationProcessor不会传递,使用了lombok生成代码的模块,需要自己声明annotationProcessor
annotationProcessor ‘org.projectlombok:lombok’
}
- 配置文件application.yml:
spring:
application:
name: client-stream-server-side