Commit 9f4cced
committed
[kafka][metrics] Fix bean conditional resolution order to prioritize user-defined beans over binder's conditional beans in a multi-binder scenario
This change modifies the loading order in DefaultBinderFactory.initializeBinderContextSimple
to ensure that user configuration classes specified via spring.main.sources are loaded before
binder configuration classes. This allows @ConditionalOnMissingBean annotations in the binder
configurations to properly detect user-provided beans.
Previously, when using KafkaBinderConfiguration with @ConditionalOnMissingBean(KafkaBinderMetrics.class),
even if the user had configured a custom KafkaBinderMetrics bean via spring.main.sources,
the condition would not work correctly because binder classes were loaded first.
Fixes gh-3114
Signed-off-by: ferblaca <[email protected]>1 parent e5d0d14 commit 9f4cced
File tree
1 file changed
+8
-2
lines changed- core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder
1 file changed
+8
-2
lines changedLines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
514 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
515 | 517 | | |
516 | 518 | | |
517 | 519 | | |
| |||
525 | 527 | | |
526 | 528 | | |
527 | 529 | | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
528 | 534 | | |
529 | 535 | | |
530 | 536 | | |
| |||
0 commit comments