openvidu-server: fix circular dependency with @PostConstruct

pull/820/head
pabloFuente 2023-09-29 13:48:09 +02:00
parent ec2396d904
commit ac64aeb2be
3 changed files with 9 additions and 4 deletions

View File

@ -157,9 +157,8 @@ public class OpenViduServer implements JsonRpcConfigurer {
@Bean
@ConditionalOnMissingBean
@DependsOn("rpcHandler")
public RpcNotificationService notificationService(RpcHandler rpcHandler) {
return new RpcNotificationService(rpcHandler);
public RpcNotificationService notificationService() {
return new RpcNotificationService();
}
@Bean

View File

@ -24,6 +24,7 @@ import java.util.List;
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<JsonObject> {
private ConcurrentMap<String, Boolean> webSocketEOFTransportError = new ConcurrentHashMap<>();
@PostConstruct
public void init() {
notificationService.setRpcHandler(this);
}
@Override
public void handleRequest(Transaction transaction, Request<JsonObject> request) throws Exception {

View File

@ -47,7 +47,7 @@ public class RpcNotificationService {
private RpcHandler rpcHandler;
public RpcNotificationService(RpcHandler rpcHandler) {
public void setRpcHandler(RpcHandler rpcHandler) {
this.rpcHandler = rpcHandler;
}