Modifying Web Adaptation

pull/353/head
shining-stars-lk 3 years ago
parent 6ed3c1c68d
commit 81b026a060

@ -23,23 +23,17 @@ import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import cn.hippo4j.core.toolkit.inet.InetUtils; import cn.hippo4j.core.toolkit.inet.InetUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import javax.servlet.Servlet;
import org.apache.catalina.startup.Tomcat;
import org.apache.coyote.UpgradeProtocol;
/** /**
* Web adapter auto configuration. * Web adapter auto configuration.
*/ */
@Configuration @Configuration
@Import({WebThreadPoolHandlerConfiguration.class})
@RequiredArgsConstructor @RequiredArgsConstructor
public class WebAdapterAutoConfiguration { public class WebAdapterAutoConfiguration {
@ -66,18 +60,6 @@ public class WebAdapterAutoConfiguration {
return new ThreadPoolRunStateHandler(hippo4JInetUtils, environment); return new ThreadPoolRunStateHandler(hippo4JInetUtils, environment);
} }
/**
* Refer to the Tomcat loading source code .
* This load is performed if the {@link Tomcat} class exists and
* the Web embedded server loads the {@link ServletWebServerFactory} top-level interface type at the same time
*/
@Bean
@ConditionalOnClass({Servlet.class, Tomcat.class, UpgradeProtocol.class})
@ConditionalOnBean(value = ServletWebServerFactory.class, search = SearchStrategy.CURRENT)
public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler(WebThreadPoolRunStateHandler webThreadPoolRunStateHandler) {
return new TomcatWebThreadPoolHandler(webThreadPoolRunStateHandler);
}
@Bean @Bean
@ConditionalOnBean(name = JETTY_SERVLET_WEB_SERVER_FACTORY) @ConditionalOnBean(name = JETTY_SERVLET_WEB_SERVER_FACTORY)
public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() { public JettyWebThreadPoolHandler jettyWebThreadPoolHandler() {

Loading…
Cancel
Save