Class OutboundConnectorRegistrationBeanPostProcessor

java.lang.Object
energy.eddie.spring.OutboundConnectorRegistrationBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.core.Ordered

public class OutboundConnectorRegistrationBeanPostProcessor extends Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.core.Ordered
  • Field Details

    • ENABLED_OUTBOUND_CONNECTOR_BEAN_NAME

      public static final String ENABLED_OUTBOUND_CONNECTOR_BEAN_NAME
      Name of the Bean registered in the core context that holds a list of the IDs of the enabled outbound-connectors.
      See Also:
    • SWAGGER_ENABLED_OUTBOUND_CONNECTOR_BEAN_NAME

      public static final String SWAGGER_ENABLED_OUTBOUND_CONNECTOR_BEAN_NAME
      Name of the Bean registered in the core context that holds a list of the IDs of the enabled outbound-connectors with a swagger endpoint.
      See Also:
    • OUTBOUND_CONNECTORS_SCAN_BASE_PACKAGE

      public static final String OUTBOUND_CONNECTORS_SCAN_BASE_PACKAGE
      Base package under which all outbound-connectors are located.
      See Also:
  • Constructor Details

    • OutboundConnectorRegistrationBeanPostProcessor

      public OutboundConnectorRegistrationBeanPostProcessor(org.springframework.core.env.Environment environment)
  • Method Details

    • classForBeanDefinition

      public static Class<?> classForBeanDefinition(org.springframework.beans.factory.config.BeanDefinition definition)
    • postProcessBeanDefinitionRegistry

      public void postProcessBeanDefinitionRegistry(@NonNull org.springframework.beans.factory.support.BeanDefinitionRegistry registry) throws InitializationException
      Scans the "energy.eddie" package for any classes that are annotated with OutboundConnector and creates a separate context and DispatcherServlet for each found class, which will be registered with the registry passed to this processor.

      Important: Only outbound-connectors that have their property outbound-connector.OC-NAME.enabled explicitly set to true are loaded.

      The DispatcherServlet has its URL mapping set to "/outbound-connectors/{name}/*" whereas name is specified by OutboundConnector.name().

      Specified by:
      postProcessBeanDefinitionRegistry in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Parameters:
      registry - the bean definition registry used by the application context
      Throws:
      InitializationException - If no outbound-connector has been enabled in the application.properties file or any other unexpected initialization error occurs.
    • postProcessBeanFactory

      public void postProcessBeanFactory(@NonNull org.springframework.beans.factory.config.ConfigurableListableBeanFactory unusedBeanFactory) throws org.springframework.beans.BeansException
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
      Throws:
      org.springframework.beans.BeansException
    • getOrder

      public int getOrder()
      Run this processor as the last one. Spring documentation recommends to implement Ordered interface for bean post processors.
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Returns:
      Integer.MAX_VALUE