From dfb8e7111399231421ffa13b3c060de2283df5e1 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期三, 25 十月 2023 11:56:49 +0800 Subject: [PATCH] 四川省网关接口相关3 --- src/main/java/com/fzzy/gateway/sc2023/api/GatewayRemoteManager.java | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fzzy/gateway/sc2023/api/GatewayRemoteManager.java b/src/main/java/com/fzzy/gateway/sc2023/api/GatewayRemoteManager.java index b438d6a..c82bb05 100644 --- a/src/main/java/com/fzzy/gateway/sc2023/api/GatewayRemoteManager.java +++ b/src/main/java/com/fzzy/gateway/sc2023/api/GatewayRemoteManager.java @@ -12,15 +12,26 @@ @Component public class GatewayRemoteManager implements ApplicationContextAware { - public static Map<String, GatewayRemoteService> remoteMap1 = new HashMap<>(); + public static Map<String, GatewayRemoteService> remoteMap = new HashMap<>(); + + public static Map<String, GatewaySyncService> syncMap = new HashMap<>(); @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - Map<String, GatewayRemoteService> serviceMap = applicationContext.getBeansOfType(GatewayRemoteService.class); + Map<String, GatewayRemoteService> serviceMap1 = applicationContext.getBeansOfType(GatewayRemoteService.class); - for (String key : serviceMap.keySet()) { - remoteMap1.put(serviceMap.get(key).getProtocol(), serviceMap.get(key)); + for (String key : serviceMap1.keySet()) { + remoteMap.put(serviceMap1.get(key).getProtocol(), serviceMap1.get(key)); } + + + Map<String, GatewaySyncService> serviceMap2 = applicationContext.getBeansOfType(GatewaySyncService.class); + + for (String key : serviceMap2.keySet()) { + syncMap.put(serviceMap2.get(key).getProtocol(), serviceMap2.get(key)); + } + + } @@ -31,7 +42,18 @@ * @return */ public GatewayRemoteService getRemoteService(String protocol) { - return remoteMap1.get(protocol); + return remoteMap.get(protocol); + } + + + /** + * 鏍规嵁瀹炵幇鍗忚鑾峰彇褰撳墠瀹炵幇鏂规硶 + * + * @param protocol + * @return + */ + public GatewaySyncService getSyncService(String protocol) { + return syncMap.get(protocol); } } -- Gitblit v1.9.3