From 92dbf00c374622193d1e519ead84b71e615e0655 Mon Sep 17 00:00:00 2001 From: iwangjie <345127857@qq.com> Date: Tue, 25 Jan 2022 18:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20#86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/DynamicThreadPoolAutoConfiguration.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java index 46b21593..90f51405 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -27,6 +27,7 @@ import cn.hippo4j.starter.toolkit.IdentifyUtil; import cn.hippo4j.starter.toolkit.inet.InetUtils; import cn.hutool.core.util.IdUtil; import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -142,13 +143,7 @@ public class DynamicThreadPoolAutoConfiguration { @Bean @ConditionalOnBean(name = "tomcatServletWebServerFactory") - public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler() { - ServletWebServerApplicationContext applicationContext = null; - try { - applicationContext = ApplicationContextHolder.getBean(ServletWebServerApplicationContext.class); - } catch (Exception ex) { - // ignore - } + public TomcatWebThreadPoolHandler tomcatWebThreadPoolHandler(@Autowired(required = false) ServletWebServerApplicationContext applicationContext) { return new TomcatWebThreadPoolHandler(applicationContext); }