Add basic GrpcChannelFactory implementation
This commit is contained in:
@@ -10,15 +10,12 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.grpc.client.GrpcChannelFactory;
|
||||
import org.springframework.grpc.sample.proto.HelloReply;
|
||||
import org.springframework.grpc.sample.proto.HelloRequest;
|
||||
import org.springframework.grpc.sample.proto.SimpleGrpc;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
|
||||
import io.grpc.Channel;
|
||||
import io.grpc.Grpc;
|
||||
import io.grpc.InsecureChannelCredentials;
|
||||
|
||||
@SpringBootTest
|
||||
public class GrpcServerApplicationTests {
|
||||
|
||||
@@ -48,13 +45,8 @@ public class GrpcServerApplicationTests {
|
||||
static class ExtraConfiguration {
|
||||
|
||||
@Bean
|
||||
SimpleGrpc.SimpleBlockingStub stub(Channel channel) {
|
||||
return SimpleGrpc.newBlockingStub(channel);
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
Channel channel() {
|
||||
return Grpc.newChannelBuilderForAddress("0.0.0.0", 9090, InsecureChannelCredentials.create()).build();
|
||||
SimpleGrpc.SimpleBlockingStub stub(GrpcChannelFactory channels) {
|
||||
return SimpleGrpc.newBlockingStub(channels.createChannel("0.0.0.0:9090").build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user