mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-14 18:19:28 +00:00
revert[proxy]: bean should be pojo class
This commit is contained in:
1 parent
06f716feb9
commit
607314a442
7 files changed
+29
-23
No files matched your search
@@ -28,6 +28,7 @@ import com.zfoo.protocol.xml.XmlProtocols;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -124,9 +125,8 @@ public class PacketService implements IPacketService {
|
||||
}
|
||||
|
||||
// 注册协议接收器
|
||||
var beanNames = applicationContext.getBeanDefinitionNames();
|
||||
for (var beanName : beanNames) {
|
||||
var bean = applicationContext.getBean(beanName);
|
||||
var componentBeans = applicationContext.getBeansWithAnnotation(Component.class);
|
||||
for (var bean : componentBeans.values()) {
|
||||
PacketBus.registerPacketReceiverDefinition(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,11 +63,15 @@ public abstract class PacketBus {
|
||||
public static void registerPacketReceiverDefinition(Object bean) {
|
||||
var clazz = bean.getClass();
|
||||
|
||||
var methods = ReflectionUtils.getMethodsByAnnotation(clazz, PacketReceiver.class);
|
||||
var methods = ReflectionUtils.getMethodsByAnnoInPOJOClass(clazz, PacketReceiver.class);
|
||||
if (ArrayUtils.isEmpty(methods)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ReflectionUtils.isPojoClass(clazz)) {
|
||||
logger.warn("The message registration class [{}] is not a POJO class, and the parent class will not be scanned", clazz);
|
||||
}
|
||||
|
||||
for (var method : methods) {
|
||||
var paramClazzs = method.getParameterTypes();
|
||||
|
||||
|
||||
Reference in new issue
Block a user