GH-9260: Fix IntegrationManagementConfiguration.obtainObservationPatterns() logic

Fixes: #9260

The current `IntegrationManagementConfiguration.obtainObservationPatterns()` is to always have an `*` as a first
pattern in the final result.
Because of `HashSet` natural order.
This would lead to ignore all the patterns, especially those with negation

* Fix `IntegrationManagementConfiguration.obtainObservationPatterns()` logic to ignore regular
patterns if `*` is present.
Optimization wise.
* Always put `*` into the end of final array let negative patterns to do their job
* Modify `IntegrationGraphServerTests` & `WebFluxObservationPropagationTests`
test configurations to ensure that `*` pattern does not have a precedence over negative patterns.

**Auto-cherry-pick to `6.3.x` & `6.2.x`**
This commit is contained in:
Artem Bilan
2024-06-25 16:25:39 -04:00
parent bdcb856a90
commit 4108ea520e
3 changed files with 20 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -290,7 +290,7 @@ public class IntegrationGraphServerTests {
@Configuration
@EnableIntegration
@EnableIntegrationManagement(observationPatterns = "myFilter")
@EnableIntegrationManagement(observationPatterns = { "myFilter", "*" })
@IntegrationComponentScan
@ImportResource("org/springframework/integration/graph/integration-graph-context.xml")
public static class Config {