From 914a7ef529a002b0762902860e0b194f73c6fe7b Mon Sep 17 00:00:00 2001 From: Parker Date: Tue, 29 Dec 2020 19:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Redis=E4=BF=A1=E9=81=93?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/cache/pushsub/receiver/RedisPushSubReceiver.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/pushsub/receiver/RedisPushSubReceiver.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/pushsub/receiver/RedisPushSubReceiver.java index bd4e501..f43ed67 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/pushsub/receiver/RedisPushSubReceiver.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/cache/pushsub/receiver/RedisPushSubReceiver.java @@ -61,7 +61,7 @@ public class RedisPushSubReceiver extends BaseReceiver { private AutowireCapableBeanFactory beanFactory; @Autowired - DefaultListableBeanFactory defaultListableBeanFactory; + private DefaultListableBeanFactory defaultListableBeanFactory; public RedisPushSubReceiver() { super(CHANNEL); @@ -75,7 +75,6 @@ public class RedisPushSubReceiver extends BaseReceiver { , RedisPushSubHandler.class ); - int count = 0; for (Class aClass : clazzSet) { // 位运算 去除抽象类 if((aClass.getModifiers() & Modifier.ABSTRACT) != 0){ @@ -91,7 +90,7 @@ public class RedisPushSubReceiver extends BaseReceiver { HANDLER_MAP.put(handler.getType(),handler); //将new出的对象放入Spring容器中 - defaultListableBeanFactory.registerSingleton("redisPushSubHandler"+count, obj); + defaultListableBeanFactory.registerSingleton(aClass.getSimpleName(), obj); //自动注入依赖 beanFactory.autowireBean(obj); @@ -99,7 +98,6 @@ public class RedisPushSubReceiver extends BaseReceiver { } catch (Exception e){ log.error(CoreMsg.REDIS_EXCEPTION_PUSH_SUB.getMessage()); } - count ++; } }