Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springBoot 1.5.x适配Web容器线程池调整 #1106

Closed
yanrongzhen opened this issue Mar 14, 2023 · 2 comments · Fixed by #1125
Closed

springBoot 1.5.x适配Web容器线程池调整 #1106

yanrongzhen opened this issue Mar 14, 2023 · 2 comments · Fixed by #1125
Assignees
Labels
in: hippo4j-config type: bug Something isn't working
Milestone

Comments

@yanrongzhen
Copy link
Member

yanrongzhen commented Mar 14, 2023

背景

在SpringBoot 1.5.x版本当中, 关于Web容器的获取和操作的api, 与SpringBoot 2.x版本(目前Hippo4j使用的主要版本)完全不兼容.
因此需要针对SpringBoot1.5.x版本做一个特定版本的实现, 以便可以操作web容器当中的线程池.

目标

通过类设计方法, 抽象和复用公共部分, 将具体针对特定版本的实现, 沉淀到下层各自版本模块当中.

实际行为

1.5x版本和2.x版本关于WEB容器的操作接口不兼容, cn.hippo4j.adapter.web.WebThreadPoolHandlerChoose.choose(WebThreadPoolHandlerChoose.java:38)
中获取实现类的时候报错.

image

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.hippo4j.adapter.web.WebThreadPoolService' available
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:352)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:339)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1094)
	at cn.hippo4j.common.config.ApplicationContextHolder.getBean(ApplicationContextHolder.java:47)
	**at cn.hippo4j.adapter.web.WebThreadPoolHandlerChoose.choose(WebThreadPoolHandlerChoose.java:38)**
	... 16 common frames omitted

解法

由于1.x已经开启一个定制化模块来进行适配(hippo4j-config-spring-boot-1x-starter), 将web容器的版本适配工作放在此模块当中.

其中, 类设计简化图示如下:

image

问题重现步骤

  1. 使用 SpringBoot 1.5.22.RELEASE版本
  2. 使用config模式, 配置tomcat/undertow/jetty 相关参数 (dynamic.thread-pool.tomcat/undertow/jetty.xxx
@magestacks
Copy link
Member

Issue 本身没问题,为了避免更多人误解,这里放个 Web 参数配置名重构链接:#1015

@magestacks magestacks added type: bug Something isn't working in: hippo4j-config labels Mar 14, 2023
@magestacks magestacks added this to the 1.5.0 milestone Mar 14, 2023
@yanrongzhen yanrongzhen changed the title springBoot 1.5.x无法获取WebThreadPoolService的实现类Bean springBoot 1.5.x适配Web容器线程池调整 Mar 16, 2023
@yanrongzhen
Copy link
Member Author

@magestacks issue的名字修改了下, 本质是适配老版本的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: hippo4j-config type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants