Skip to content

Disable Micrometer global registry in tests by default - #51142

Open
LordKay-sudo wants to merge 2 commits into
spring-projects:mainfrom
LordKay-sudo:disable-global-meter-registry-in-tests
Open

Disable Micrometer global registry in tests by default#51142
LordKay-sudo wants to merge 2 commits into
spring-projects:mainfrom
LordKay-sudo:disable-global-meter-registry-in-tests

Conversation

@LordKay-sudo

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #50886 / @mhalbritter's request: land the deferred test-only change on main (4.2.x).

  • Add DisableGlobalMeterRegistryContextCustomizerFactory so tests default management.metrics.use-global-registry=false when unset
  • Mirror the existing Reactor global-resources customizer pattern
  • Leave explicit management.metrics.use-global-registry values untouched

This is intentionally separate from the MeterRegistryCloser fix already merged into 4.0.x.

Test plan

  • Unit tests for default-off and explicit-property preservation
  • ./gradlew :core:spring-boot-test:test --tests DisableGlobalMeterRegistryContextCustomizerFactoryTests
  • CI Build Pull Request

Default management.metrics.use-global-registry to false in tests when
unset, mirroring the Reactor global-resources customizer, so Micrometer
does not pin cached application contexts.

Follow-up to spring-projectsgh-50886 for main (4.2.x).

Signed-off-by: LordKay-sudo <lkandiro@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 28, 2026
Ensure files end with a newline for Checkstyle and expand unit tests
around explicit property values, factory classpath gating, and
equals/hashCode for context caching.

Signed-off-by: LordKay-sudo <lkandiro@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants