From cf32ecc88edf6b5980d6dcee054226984fbe06e2 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 28 Jun 2017 19:09:13 +0900 Subject: [PATCH] proxy server --- src/main/java/com/loafle/overflow/proxy/ServiceProxy.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java b/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java index 383bc53..a384666 100644 --- a/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java +++ b/src/main/java/com/loafle/overflow/proxy/ServiceProxy.java @@ -23,12 +23,14 @@ public class ServiceProxy { private static final Logger logger = Logger.getLogger(ServiceProxy.class.getName()); private io.grpc.Server server; + public static ApplicationContext ctx; public ServiceProxy() { } public void start(int port) throws IOException { + ctx = new AnnotationConfigApplicationContext("com.loafle.overflow"); server = ServerBuilder.forPort(port) .addService(new ServiceImpl()) .build() @@ -61,7 +63,7 @@ public class ServiceProxy { @Override public void exec(ServerInput request, io.grpc.stub.StreamObserver responseObserver) { - ApplicationContext ctx = new AnnotationConfigApplicationContext("com.loafle.overflow"); + String targetServiceName = request.getTarget(); Object service = ctx.getBean(targetServiceName);