Comments (2)
我尝试的改了一下这个问题,ServerEndpointExporter 再实现一个后置处理器接口 BeanDefinitionRegistryPostProcessor
,registerEndpoints中的scanPackage方法
放到postProcessBeanFactory
方法中执行,让扫描提前执行,就不会再报异常
`public class ServerEndpointExporter extends ApplicationObjectSupport implements SmartInitializingSingleton, BeanFactoryAware, ResourceLoaderAware,BeanDefinitionRegistryPostProcessor {
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
ApplicationContext context = getApplicationContext();
scanPackage(context);
}
protected void registerEndpoints() {
ApplicationContext context = getApplicationContext();
// scanPackage(context);
String[] endpointBeanNames = context.getBeanNamesForAnnotation(ServerEndpoint.class);
Set<Class<?>> endpointClasses = new LinkedHashSet<>();
for (String beanName : endpointBeanNames) {
endpointClasses.add(context.getType(beanName));
}
for (Class<?> endpointClass : endpointClasses) {
if (ClassUtils.isCglibProxyClass(endpointClass)) {
registerEndpoint(endpointClass.getSuperclass());
} else {
registerEndpoint(endpointClass);
}
}
init();
}
}`
from netty-websocket-spring-boot-starter.
我怎么感觉你的用法跟我的相反了,不是应该是MyWebSocket注入其他bean吗
from netty-websocket-spring-boot-starter.
Related Issues (20)
- BeforeHandshake关闭session后,nginx转发http响应的502 HOT 2
- 想问下服务器如何判断客户端掉线,然后通知他的好友 HOT 2
- writerIdleTimeSeconds配置使用${引用nacos配置},不能做到动态刷新 HOT 1
- 整合RocketMq后异常日志不全 HOT 2
- netty默认的Channel的通道id太长了,目前框架上支持这个id自定义吗? HOT 1
- 客户端断网后服务端不知道客户端断开了 HOT 1
- 请问如何处理数据库存储的客户端连接状态,假如单节点部署,重启过程中客户端离线,数据库的状态如何改变呢,有什么策略可以主动ping客户端吗 HOT 1
- 想问一下0.12版本客户端访问问题 HOT 1
- 客户端在线,服务端离线 HOT 1
- 是否支持socketjs+stomp? HOT 1
- 连接报错,发送消息也报错。。。看内容吧。。。 HOT 3
- 能否支持自定义全局异常处理? HOT 1
- 能否进一步优化反射方法性能 HOT 1
- 0.12.0使用的netty版本和文档不一致 HOT 2
- 支持TCP吗?
- pojoClazz 不是单例的吗
- 不支持jdk17么?
- 支持SpringBoot3.2吗 HOT 3
- 如何控制@onClose的关闭时间
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netty-websocket-spring-boot-starter.