diff --git a/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java b/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java index f5b2974846..3d6f077770 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java +++ b/openvidu-server/src/main/java/io/openvidu/server/OpenViduServer.java @@ -157,9 +157,8 @@ public RpcHandler rpcHandler() { @Bean @ConditionalOnMissingBean - @DependsOn("rpcHandler") - public RpcNotificationService notificationService(RpcHandler rpcHandler) { - return new RpcNotificationService(rpcHandler); + public RpcNotificationService notificationService() { + return new RpcNotificationService(); } @Bean diff --git a/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcHandler.java b/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcHandler.java index 2d5d1bbd54..8fa611cbf6 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcHandler.java +++ b/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcHandler.java @@ -24,6 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import javax.annotation.PostConstruct; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.RandomStringUtils; @@ -83,6 +84,11 @@ public class RpcHandler extends DefaultJsonRpcHandler { private ConcurrentMap webSocketEOFTransportError = new ConcurrentHashMap<>(); + @PostConstruct + public void init() { + notificationService.setRpcHandler(this); + } + @Override public void handleRequest(Transaction transaction, Request request) throws Exception { diff --git a/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcNotificationService.java b/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcNotificationService.java index 621044be51..9870e2768a 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcNotificationService.java +++ b/openvidu-server/src/main/java/io/openvidu/server/rpc/RpcNotificationService.java @@ -47,7 +47,7 @@ public class RpcNotificationService { private RpcHandler rpcHandler; - public RpcNotificationService(RpcHandler rpcHandler) { + public void setRpcHandler(RpcHandler rpcHandler) { this.rpcHandler = rpcHandler; }