ServerEndpointExporter.java 文件源码

java
阅读 64 收藏 0 点赞 0 评论 0

项目:spring4-understanding 作者:
/**
 * Actually register the endpoints. Called by {@link #afterSingletonsInstantiated()}.
 */
protected void registerEndpoints() {
    Set<Class<?>> endpointClasses = new LinkedHashSet<Class<?>>();
    if (this.annotatedEndpointClasses != null) {
        endpointClasses.addAll(this.annotatedEndpointClasses);
    }

    ApplicationContext context = getApplicationContext();
    if (context != null) {
        String[] endpointBeanNames = context.getBeanNamesForAnnotation(ServerEndpoint.class);
        for (String beanName : endpointBeanNames) {
            endpointClasses.add(context.getType(beanName));
        }
    }

    for (Class<?> endpointClass : endpointClasses) {
        registerEndpoint(endpointClass);
    }

    if (context != null) {
        Map<String, ServerEndpointConfig> endpointConfigMap = context.getBeansOfType(ServerEndpointConfig.class);
        for (ServerEndpointConfig endpointConfig : endpointConfigMap.values()) {
            registerEndpoint(endpointConfig);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号