|
|
@ -23,10 +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.embedded.tomcat.TomcatServletWebServerFactory;
|
|
|
|
|
|
|
|
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.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.
|
|
|
@ -35,8 +42,6 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
public class WebAdapterAutoConfiguration {
|
|
|
|
public class WebAdapterAutoConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TOMCAT_SERVLET_WEB_SERVER_FACTORY = "tomcatServletWebServerFactory";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String JETTY_SERVLET_WEB_SERVER_FACTORY = "JettyServletWebServerFactory";
|
|
|
|
private static final String JETTY_SERVLET_WEB_SERVER_FACTORY = "JettyServletWebServerFactory";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String UNDERTOW_SERVLET_WEB_SERVER_FACTORY = "undertowServletWebServerFactory";
|
|
|
|
private static final String UNDERTOW_SERVLET_WEB_SERVER_FACTORY = "undertowServletWebServerFactory";
|
|
|
@ -61,7 +66,8 @@ public class WebAdapterAutoConfiguration {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnBean(name = TOMCAT_SERVLET_WEB_SERVER_FACTORY)
|
|
|
|
@ConditionalOnClass({Servlet.class, Tomcat.class, UpgradeProtocol.class})
|
|
|
|
|
|
|
|
@ConditionalOnBean(value = ServletWebServerFactory.class, search = SearchStrategy.CURRENT)
|
|
|
|
public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler(WebThreadPoolRunStateHandler webThreadPoolRunStateHandler) {
|
|
|
|
public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler(WebThreadPoolRunStateHandler webThreadPoolRunStateHandler) {
|
|
|
|
return new TomcatWebThreadPoolHandler(webThreadPoolRunStateHandler);
|
|
|
|
return new TomcatWebThreadPoolHandler(webThreadPoolRunStateHandler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|