Class JdkHttpClientResourceFactory
java.lang.Object
org.springframework.http.client.reactive.JdkHttpClientResourceFactory
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean
public class JdkHttpClientResourceFactory
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Factory to manage JDK HttpClient resources such as a shared
Executor
within the lifecycle of a Spring ApplicationContext.
This factory implements InitializingBean and DisposableBean
and is expected typically to be declared as a Spring-managed bean.
- Since:
- 6.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()Return the configuredExecutor.voidsetExecutor(@Nullable Executor executor) Configure theExecutorto use forHttpClientexchanges.voidsetThreadPrefix(String threadPrefix) Configure the thread prefix to initialize the executor with.
-
Constructor Details
-
JdkHttpClientResourceFactory
public JdkHttpClientResourceFactory()
-
-
Method Details
-
setExecutor
Configure theExecutorto use forHttpClientexchanges. The given executor is started and stopped viaInitializingBeanandDisposableBean.By default, this is set to
Executors.newCachedThreadPool(ThreadFactory), which mirrorsHttpClient.Builder.executor(Executor).- Parameters:
executor- the executor to use
-
getExecutor
-
setThreadPrefix
-
afterPropertiesSet
-
destroy
-