Related to https://github.com/spring-projects/spring-integration/issues/3420
After fixing https://github.com/spring-projects/spring-integration/issues/3376
to make sure that Spring Integration has a dependency on the MeterRegistry
for the proper lifecycle on shutdown, it turns out that Spring Integration
metrics features must be configured after the MeterRegistry
is
provided properly by Spring Boot
Note: we start observing the wrong order problem when we also have an
IntegrationGraphEndpointAutoConfiguration
which is ordered alphabetically
(therefore before MetricsAutoConfiguration
) and pushes an
IntegrationAutoConfiguration
up - before MetricsAutoConfiguration
- Add
@AutoConfigureBefore(IntegrationAutoConfiguration.class)
to theCompositeMeterRegistryAutoConfiguration
to ensure thatMeterRegistry
bean is provided before@EnableIntegrationManagement
logic
Back-port to master
moving @AutoConfigureBefore(IntegrationAutoConfiguration.class)
onto the MeterRegistryAutoConfiguration
already
Comment From: artembilan
So, I pushed the fix according our discussion. And now this depends on the: https://github.com/spring-projects/spring-integration/pull/3427.
We still need to have an auto-configuration order between metrics and Integration since we have a logic in Spring Integration to register or not some bean when MeterRegistry
is present in the context or not.
We probably will get rid of it in the next Spring Integration 6.0
.
Thanks
Comment From: wilkinsona
I've pushed a squashed and slightly polished version of the proposal here. I'd like the rest of the team to take a look before merging as the new auto-configuration class is one-of-a-kind.
Comment From: wilkinsona
@artembilan I see you've made the Integration change in 5.2 and later but the base branch of this PR is 2.3.x which uses SI 5.3.x. Should we be looking to make the changes proposed here in Boot 2.2.x and later?
Comment From: artembilan
Thank you, @wilkinsona , for your help!
Yes, I think this has to be back-ported to Spring Boot 2.2.x
and of course to master
.
I missed somehow the fact that Boot 2.2.x
is still in support.