Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 784 Bytes

File metadata and controls

47 lines (35 loc) · 784 Bytes

Spring Boot

1. 引入依赖

val nettyRpcVersion = "0.0.1-SNAPSHOT"

repositories {
    maven {
        setUrl("https://maven.pkg.github.com/helloworlde/netty-rpc")
    }
}

dependencies {
    // 客户端
    implementation("io.github.helloworlde:netty-rpc-spring-boot-starter-client:${nettyRpcVersion}")
    // 服务端
    implementation("io.github.helloworlde:netty-rpc-spring-boot-starter-server:${nettyRpcVersion}")
}

2. 服务端

  • 实现服务
@NettyRpcService
@Slf4j
public class HelloServiceImpl implements HelloService {
    // ...
}

3. 客户端

  • 接口调用
@RestController
public class ExampleController {

    @NettyRpcClient("netty-rpc-server")
    private HelloService helloService;
    
    // ...
}