码迷,mamicode.com
首页 > 编程语言 > 详细

Spring boot加载REACTIVE程序过程

时间:2018-10-23 20:57:46      阅读:1363      评论:0      收藏:0      [点我收藏+]

标签:sim   ann   turn   Servle   null   row   protect   patch   catch   

spring-boot通过判断含org.springframework.web.reactive.DispatcherHandler类就肯定程序类型是REACTIVE,然后加载上下文类org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext,看下面代码
private WebApplicationType deduceWebApplicationType() {
        if (ClassUtils.isPresent("org.springframework.web.reactive.DispatcherHandler", (ClassLoader)null) && !ClassUtils.isPresent("org.springframework.web.servlet.DispatcherServlet", (ClassLoader)null) && !ClassUtils.isPresent("org.glassfish.jersey.server.ResourceConfig", (ClassLoader)null)) {
            return WebApplicationType.REACTIVE;
        } else {
            String[] var1 = WEB_ENVIRONMENT_CLASSES;
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                String className = var1[var3];
                if (!ClassUtils.isPresent(className, (ClassLoader)null)) {
                    return WebApplicationType.NONE;
                }
            }

            return WebApplicationType.SERVLET;
        }
    }

 WebServer在org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext创建

    protected void onRefresh() {
        super.onRefresh();

        try {
            this.createWebServer();
        } catch (Throwable var2) {
            throw new ApplicationContextException("Unable to start reactive web server", var2);
        }
    }

 


Spring boot加载REACTIVE程序过程

标签:sim   ann   turn   Servle   null   row   protect   patch   catch   

原文地址:https://www.cnblogs.com/birdstudio/p/9838060.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!