mirror of https://github.com/swwheihei/wvp.git
解决spring循环注入导致的服务无法启动
parent
4abeadc636
commit
0d6a8d90c5
|
@ -34,6 +34,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.impl.CancelResponseProces
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.InviteResponseProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.InviteResponseProcessor;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.OtherResponseProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.response.impl.OtherResponseProcessor;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
|
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,12 +83,10 @@ public class SIPProcessorFactory {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OtherResponseProcessor otherResponseProcessor;
|
private OtherResponseProcessor otherResponseProcessor;
|
||||||
|
|
||||||
@Autowired
|
// 注:这里使用注解会导致循环依赖注入,暂用springBean
|
||||||
@Qualifier(value="tcpSipProvider")
|
|
||||||
private SipProvider tcpSipProvider;
|
private SipProvider tcpSipProvider;
|
||||||
|
|
||||||
@Autowired
|
// 注:这里使用注解会导致循环依赖注入,暂用springBean
|
||||||
@Qualifier(value="udpSipProvider")
|
|
||||||
private SipProvider udpSipProvider;
|
private SipProvider udpSipProvider;
|
||||||
|
|
||||||
public ISIPRequestProcessor createRequestProcessor(RequestEvent evt) {
|
public ISIPRequestProcessor createRequestProcessor(RequestEvent evt) {
|
||||||
|
@ -97,14 +96,14 @@ public class SIPProcessorFactory {
|
||||||
if (Request.INVITE.equals(method)) {
|
if (Request.INVITE.equals(method)) {
|
||||||
InviteRequestProcessor processor = new InviteRequestProcessor();
|
InviteRequestProcessor processor = new InviteRequestProcessor();
|
||||||
processor.setRequestEvent(evt);
|
processor.setRequestEvent(evt);
|
||||||
processor.setTcpSipProvider(tcpSipProvider);
|
processor.setTcpSipProvider(getTcpSipProvider());
|
||||||
processor.setUdpSipProvider(udpSipProvider);
|
processor.setUdpSipProvider(getUdpSipProvider());
|
||||||
return processor;
|
return processor;
|
||||||
} else if (Request.REGISTER.equals(method)) {
|
} else if (Request.REGISTER.equals(method)) {
|
||||||
RegisterRequestProcessor processor = new RegisterRequestProcessor();
|
RegisterRequestProcessor processor = new RegisterRequestProcessor();
|
||||||
processor.setRequestEvent(evt);
|
processor.setRequestEvent(evt);
|
||||||
processor.setTcpSipProvider(tcpSipProvider);
|
processor.setTcpSipProvider(getTcpSipProvider());
|
||||||
processor.setUdpSipProvider(udpSipProvider);
|
processor.setUdpSipProvider(getUdpSipProvider());
|
||||||
processor.setHandler(handler);
|
processor.setHandler(handler);
|
||||||
processor.setPublisher(publisher);
|
processor.setPublisher(publisher);
|
||||||
processor.setSipConfig(sipConfig);
|
processor.setSipConfig(sipConfig);
|
||||||
|
@ -129,8 +128,8 @@ public class SIPProcessorFactory {
|
||||||
} else if (Request.MESSAGE.equals(method)) {
|
} else if (Request.MESSAGE.equals(method)) {
|
||||||
MessageRequestProcessor processor = new MessageRequestProcessor();
|
MessageRequestProcessor processor = new MessageRequestProcessor();
|
||||||
processor.setRequestEvent(evt);
|
processor.setRequestEvent(evt);
|
||||||
processor.setTcpSipProvider(tcpSipProvider);
|
processor.setTcpSipProvider(getTcpSipProvider());
|
||||||
processor.setUdpSipProvider(udpSipProvider);
|
processor.setUdpSipProvider(getUdpSipProvider());
|
||||||
processor.setPublisher(publisher);
|
processor.setPublisher(publisher);
|
||||||
processor.setRedis(redis);
|
processor.setRedis(redis);
|
||||||
processor.setDeferredResultHolder(deferredResultHolder);
|
processor.setDeferredResultHolder(deferredResultHolder);
|
||||||
|
@ -158,4 +157,18 @@ public class SIPProcessorFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SipProvider getTcpSipProvider() {
|
||||||
|
if (tcpSipProvider == null) {
|
||||||
|
tcpSipProvider = (SipProvider) SpringBeanFactory.getBean("tcpSipProvider");
|
||||||
|
}
|
||||||
|
return tcpSipProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SipProvider getUdpSipProvider() {
|
||||||
|
if (udpSipProvider == null) {
|
||||||
|
udpSipProvider = (SipProvider) SpringBeanFactory.getBean("udpSipProvider");
|
||||||
|
}
|
||||||
|
return udpSipProvider;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue