Skip to content

Fix: Add EnvironmentPostProcessor for conditional RabbitMQ/Kafka exclusion#13

Merged
ancongui merged 1 commit into
developfrom
fix/resolve-duplicate-bean-registrations
Feb 13, 2026
Merged

Fix: Add EnvironmentPostProcessor for conditional RabbitMQ/Kafka exclusion#13
ancongui merged 1 commit into
developfrom
fix/resolve-duplicate-bean-registrations

Conversation

@casc84ab

Copy link
Copy Markdown
Contributor

Summary

  • Add FireflyEdaEnvironmentPostProcessor that excludes RabbitMQ and Kafka auto-configurations when neither publisher nor consumer properties are enabled
  • Prevents health check errors for unconfigured messaging infrastructure at startup
  • Configuration-driven approach via application.yml properties

Test plan

  • All 1,248 framework tests pass
  • 29/36 microservices start cleanly with zero RabbitMQ warnings
  • No duplicate bean registrations detected

…fka auto-configurations

When neither firefly.eda.rabbit nor firefly.eda.kafka publisher/consumer
properties are enabled, the corresponding Spring Boot auto-configurations
are excluded at startup, preventing health check errors for unconfigured
messaging infrastructure.
@casc84ab casc84ab requested a review from ancongui February 13, 2026 16:00

@ancongui ancongui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is the most substantial change in the series, but well-implemented:

Architecture: Using EnvironmentPostProcessor (registered via spring.factories) is the correct approach for conditionally excluding auto-configurations early in the startup lifecycle — before bean definitions are created.

Logic: The exclusion logic correctly:

  • Checks both publisher and consumer properties for each transport (RabbitMQ/Kafka)
  • Respects explicit Spring Boot native configuration (spring.rabbitmq.host, spring.kafka.bootstrap-servers) as an override
  • Preserves any existing spring.autoconfigure.exclude entries
  • Uses addFirst priority so application properties can still override

pom.xml: Removing "Optional" comments from Kafka/RabbitMQ dependencies makes sense — they need to be on the compile classpath for the post-processor, with runtime exclusion now handled programmatically.

Registration: spring.factories is still the correct registration mechanism for EnvironmentPostProcessor in Spring Boot 3.x (unlike auto-configurations which migrated to .imports).

@ancongui ancongui merged commit f8077ae into develop Feb 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants