Package energy.eddie.spring
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the Bean registered in the core context that holds a list of the IDs of the enabled outbound-connectors.static final StringBase package under which all outbound-connectors are located.static final StringName of the Bean registered in the core context that holds a list of the IDs of the enabled outbound-connectors with a swagger endpoint.Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionOutboundConnectorRegistrationBeanPostProcessor(org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> classForBeanDefinition(org.springframework.beans.factory.config.BeanDefinition definition) intgetOrder()Run this processor as the last one.voidpostProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) Scans the "energy.eddie" package for any classes that are annotated withOutboundConnectorand creates a separate context andDispatcherServletfor each found class, which will be registered with the registry passed to this processor.voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory unusedBeanFactory)
-
Field Details
-
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
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
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 withOutboundConnectorand creates a separate context andDispatcherServletfor 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
nameis specified byOutboundConnector.name().- Specified by:
postProcessBeanDefinitionRegistryin interfaceorg.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 theapplication.propertiesfile 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:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Specified by:
postProcessBeanFactoryin interfaceorg.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 implementOrderedinterface for bean post processors.- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Returns:
- Integer.MAX_VALUE
-