自動的に埋め込まれたサーブレットコンテナの構成原理をspringboot

@Configuration(proxyBeanMethods = 
@ConditionalOnWebApplication 
@EnableConfigurationProperties(ServerProperties。クラスパブリック クラスEmbeddedWebServerFactoryCustomizerAutoConfiguration { 

    / ** 
     *如果容器中有Tomcat.class就使用Tomcatの容器
     * / 
    @Configuration(proxyBeanMethods = 
    @ConditionalOnClass({にTomcat。クラス、UpgradeProtocol。クラス})
     パブリック 静的 クラスTomcatWebServerFactoryCustomizerConfiguration { 

        @Bean 
        公衆TomcatWebServerFactoryCustomizer tomcatWebServerFactoryCustomizer(環境環境、
                ServerProperties serverProperties){ 
            リターン 新しいTomcatWebServerFactoryCustomizer(環境、serverProperties)。
        } 

    } 

    / ** 
     *如果容器中有桟橋
     * / 
    @Configuration(proxyBeanMethods = 
    @ConditionalOnClass({サーバー。クラス、ローダ。クラス、WebAppContext。クラス})
     パブリック 静的 クラスJettyWebServerFactoryCustomizerConfiguration { 

        @Bean 
        公衆JettyWebServerFactoryCustomizer jettyWebServerFactoryCustomizer(環境環境、
                ServerProperties serverProperties){ 
            リターン 新しいJettyWebServerFactoryCustomizer(環境、serverProperties)。
        } 

    } 

    / ** 
     *如果容器中有アンダートウ就加载アンダートウ
     * / 
    @Configuration(proxyBeanMethods = 
    @ConditionalOnClass({アンダートウ。クラス、SslClientAuthMode。クラス})
     パブリック 静的 クラスUndertowWebServerFactoryCustomizerConfiguration { 

        @Bean 
        公衆UndertowWebServerFactoryCustomizer undertowWebServerFactoryCustomizer(環境環境、
                ServerProperties serverProperties){ 
            リターン 新しいUndertowWebServerFactoryCustomizer(環境、serverProperties)。
        } 

    } 

    / ** 
     *ネッティーが使用されている場合はネストされた構成。
     * / 
    @Configuration(proxyBeanMethods = 
    @ConditionalOnClass(HttpServerを。クラスパブリック 静的 クラスNettyWebServerFactoryCustomizerConfiguration { 

        @Bean 
        公衆NettyWebServerFactoryCustomizer nettyWebServerFactoryCustomizer(環境環境、
                ServerProperties serverProperties){ 
            リターン 新しいNettyWebServerFactoryCustomizer(環境、serverProperties)。
        } 

    } 

}

springbootウェブモジュールの既定の依存tomca、他の依存の導入を組み込みのサーブレットを変更および削除Tomcatにそれに依存しています

おすすめ

転載: www.cnblogs.com/vegeta-xiao/p/12509962.html