In what version(s) of Spring Integration are you seeing this issue?
This was reported against Spring Integration 5.2.6, but I believe older and newer versions are also affected.
Describe the bug
Spring Integration registers 3 gauges where the value is calculated by calling getBeansOfType() on the application context for MessageChannel, MessageHandler, and MessageSource beans. It does so in such a way that there are no bean dependency relationships between the meter registry and the MessageChannel, MessageHandler, and MessageSource beans. During context close processing, this allows those beans to be destroyed before the meter registry is destroyed. As a result query the gauges in the meter registry can result in bean creation being attempted and a BeanCreationNotAllowedException is then thrown.
To Reproduce
Courtesy of @tkvangorder, a sample that reproduces the problem is available here. There's also some background information in this Spring Boot pull request.
Expected behavior
Gauges should be implemented or registered in such a way that the MeterRegistry can be used during application context close processing.
Sample
https://github.com/tkvangorder/spring-task-issue