Class AbstractHttpServiceRegistrar

java.lang.Object
org.springframework.web.service.registry.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

public abstract class AbstractHttpServiceRegistrar extends Object implements org.springframework.context.annotation.ImportBeanDefinitionRegistrar, org.springframework.context.EnvironmentAware, org.springframework.context.ResourceLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanClassLoaderAware
Abstract registrar class that imports:
  • Bean definitions for HTTP Service interface client proxies organized by HttpServiceGroup.
  • Bean definition for an HttpServiceProxyRegistryFactoryBean that initializes the infrastructure for each group, RestClient or WebClient and 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:
  • Field Details

  • Constructor Details

    • AbstractHttpServiceRegistrar

      public AbstractHttpServiceRegistrar()
  • Method Details

    • setDefaultClientType

      public void setDefaultClientType(HttpServiceGroup.ClientType defaultClientType)
      Set the client type to use when an HTTP Service group's client type remains HttpServiceGroup.ClientType.UNSPECIFIED.

      By default, when this property is not set, then REST_CLIENT is used for any HTTP Service group whose client type remains unspecified.

    • setEnvironment

      public void setEnvironment(org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
    • setResourceLoader

      public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
      Specified by:
      setResourceLoader in interface org.springframework.context.ResourceLoaderAware
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader beanClassLoader)
      Specified by:
      setBeanClassLoader in interface org.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:
      registerBeanDefinitions in interface org.springframework.context.annotation.ImportBeanDefinitionRegistrar
    • registerBeanDefinitions

      public final void registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata metadata, org.springframework.beans.factory.support.BeanDefinitionRegistry beanRegistry)
      Specified by:
      registerBeanDefinitions in interface org.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 with
      importingClassMetadata - annotation metadata of the importing class