优化 Web 容器上下文获取.

pull/87/head
chen.ma 3 years ago
parent 45d2d9569e
commit 19897f8a8e

@ -57,8 +57,6 @@ public class DynamicThreadPoolAutoConfiguration {
private final ConfigurableEnvironment environment; private final ConfigurableEnvironment environment;
private final ServletWebServerApplicationContext applicationContext;
public static final String CLIENT_IDENTIFICATION_VALUE = IdUtil.simpleUUID(); public static final String CLIENT_IDENTIFICATION_VALUE = IdUtil.simpleUUID();
@Bean @Bean
@ -145,6 +143,12 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean @Bean
@ConditionalOnBean(name = "tomcatServletWebServerFactory") @ConditionalOnBean(name = "tomcatServletWebServerFactory")
public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler() { public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler() {
ServletWebServerApplicationContext applicationContext = null;
try {
applicationContext = ApplicationContextHolder.getBean(ServletWebServerApplicationContext.class);
} catch (Exception ex) {
// ignore
}
return new TomcatWebThreadPoolHandler(applicationContext); return new TomcatWebThreadPoolHandler(applicationContext);
} }

Loading…
Cancel
Save