Files
spring-integration/spring-integration-core/src
Artem Bilan 74cf59bacb GH-9890: Fix ControlBusCommandRegistry for requiresDestruction()
Fixes: #9890
Issue link: https://github.com/spring-projects/spring-integration/issues/9890

The `DestructionAwareBeanPostProcessor.requiresDestruction()` defaults to `true`.
As a result, beans that are not meant to be processed during the destroy lifecycle
are being registered for the `AbstractBeanFactory#registerDisposableBeanIfNecessary`.
for example, the `SimpleThreadScope` does not support destruction callbacks.

In other words, the `DestructionAwareBeanPostProcessor.requiresDestruction()` contract
is not merely for `DestructionAwareBeanPostProcessor` logic, but also has an effect
on the whole `BeanFactory`

* Implement `requiresDestruction()` in the `ControlBusCommandRegistry`
for same filter as `registerControlBusCommands()` does right now.
* Optimize behaviour using `MergedAnnotations` for the class instead of
`AnnotationUtils.findAnnotation()` twice, which creates the mentioned `MergedAnnotations` internally.

**Auto-cherry-pick to `6.4.x`**
2025-03-13 14:29:41 -04:00
..