Class AbstractHttpServiceRegistrar
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.annotation.ImportBeanDefinitionRegistrar, org.springframework.context.EnvironmentAware, org.springframework.context.ResourceLoaderAware
- Bean definitions for HTTP Service interface client proxies organized by
HttpServiceGroup. - Bean definition for an
HttpServiceProxyRegistryFactoryBeanthat initializes the infrastructure for each group,RestClientorWebClientand a proxy factory, necessary to create the proxies.
Subclasses determine the HTTP Service types (interfaces with
@HttpExchange methods) to register by implementing
registerHttpServices(AbstractHttpServiceRegistrar.GroupRegistry, AnnotationMetadata).
There is built-in support for declaring HTTP Services through
ImportHttpServices annotations. It is also possible to perform
registrations directly, sourced in another way, by extending this class.
It is possible to import multiple instances of this registrar type.
Subsequent imports update the existing registry FactoryBean
definition, and likewise merge HTTP Service group definitions.
An application can autowire HTTP Service proxy beans, or autowire the
HttpServiceProxyRegistry from which to obtain proxies.
- Since:
- 7.0
- Author:
- Rossen Stoyanchev, Phillip Webb, Olga Maciaszek-Sharma, Stephane Nicoll
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceRegistry API to allow subclasses to register HTTP Services. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe bean name of theHttpServiceProxyRegistry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidregisterBeanDefinitions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.beans.factory.support.BeanDefinitionRegistry beanRegistry) final voidregisterBeanDefinitions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.beans.factory.support.BeanNameGenerator generator) protected abstract voidregisterHttpServices(AbstractHttpServiceRegistrar.GroupRegistry registry, org.springframework.core.type.AnnotationMetadata importingClassMetadata) This method is called before any bean definition registrations are made.voidsetBeanClassLoader(ClassLoader beanClassLoader) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetDefaultClientType(HttpServiceGroup.ClientType defaultClientType) Set the client type to use when an HTTP Service group's client type remainsHttpServiceGroup.ClientType.UNSPECIFIED.voidsetEnvironment(org.springframework.core.env.Environment environment) voidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
-
Field Details
-
HTTP_SERVICE_PROXY_REGISTRY_BEAN_NAME
The bean name of theHttpServiceProxyRegistry.- See Also:
-
-
Constructor Details
-
AbstractHttpServiceRegistrar
public AbstractHttpServiceRegistrar()
-
-
Method Details
-
setDefaultClientType
Set the client type to use when an HTTP Service group's client type remainsHttpServiceGroup.ClientType.UNSPECIFIED.By default, when this property is not set, then
REST_CLIENTis used for any HTTP Service group whose client type remains unspecified. -
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoaderin interfaceorg.springframework.context.ResourceLoaderAware
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceorg.springframework.beans.factory.BeanClassLoaderAware
-
registerBeanDefinitions
public final void registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.beans.factory.support.BeanNameGenerator generator) - Specified by:
registerBeanDefinitionsin interfaceorg.springframework.context.annotation.ImportBeanDefinitionRegistrar
-
registerBeanDefinitions
public final void registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.beans.factory.support.BeanDefinitionRegistry beanRegistry) - Specified by:
registerBeanDefinitionsin interfaceorg.springframework.context.annotation.ImportBeanDefinitionRegistrar
-
registerHttpServices
protected abstract void registerHttpServices(AbstractHttpServiceRegistrar.GroupRegistry registry, org.springframework.core.type.AnnotationMetadata importingClassMetadata) This method is called before any bean definition registrations are made. Subclasses must implement it to register the HTTP Services for which bean definitions for which proxies need to be created.- Parameters:
registry- to perform HTTP Service registrations withimportingClassMetadata- annotation metadata of the importing class
-