Class JdkHttpClientResourceFactory
java.lang.Object
org.springframework.http.client.reactive.JdkHttpClientResourceFactory
- All Implemented Interfaces:
 DisposableBean,InitializingBean
public class JdkHttpClientResourceFactory
extends Object
implements InitializingBean, 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 TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.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
Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
 afterPropertiesSetin interfaceInitializingBean- Throws:
 Exception- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
 - 
destroy
Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
 destroyin interfaceDisposableBean- Throws:
 Exception- in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources as well.
 
 -