-
Sub-task
-
Resolution: Fixed
-
L3 - Default
-
None
-
None
-
None
Previously
Two approaches were used to register internal beans:
- For subscriptions BeanDefinitionRegistryPostProcessor was used
- SubscriptionPostProcessor was activated via @Import annotation in the @EnableExternalTaskClient annotation
- While this works technically, it is not documented, and the behavior might change with future spring releases
- SubscriptionPostProcessor was activated via @Import annotation in the @EnableExternalTaskClient annotation
- For the client ImportBeanDefinitionRegistrar was used
- Activating it via @Import annotation is well-documented here
Now
- The client uses ImportBeanDefinitionRegistrar as well
- Both post processors are configured in the newly introduced class PostProcessorConfiguration and imported via @Import annotation in the @EnableExternalTaskClient annotation
Reasoning
Another solution would have been to create a configuration class only for the SubscriptionPostProcessor and import it. However, we used the chance to consolidate how we create internal beans to the BeanDefinitionRegistryPostProcessor approach. The post-processor approach is better documented and more powerful since it makes all beans available in the registry, no matter if these are method-level or class-level exposed beans. Whereas the ImportBeanDefinitionRegistrar only makes class-level beans available in the registry. When @EnableExternalTaskClient on method-level becomes a requirement in the future, we can achieve this easily with the BeanDefinitionRegistryPostProcessor.