-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I am working on decomposing an application that is currently deployed as a monolith but will be separated into services communicating over message queues. I'm using Spring Integration to define in-memory channels for now so that we can migrate them to external queues with adapters.
I have an interface Updater
that I'll use as a gateway but that is also concretely implemented in one of the monolith components:
// in shared jar
interface Updater {
void update(Entity entity)
}
// in component-foo
class UpdaterImpl implements Updater {
...
}
When I define an IntegrationFlows.from(Updater)
in my configuration, I get a Spring context error because I have multiple Updater
beans in the context. The usual approach to fixing this is to mark one of the beans as @Primary
, but there doesn't seem to be any way to do that with a DSL integration flow; applying @Primary
to the @Bean IntegrationFlow updater
has no effect.
It would be useful for primaryness to be propagated to gateway beans created by the DSL. Perhaps the infrastructure could examine the "current bean" definition to see if it's primary and then copy that onto the gateway being constructed?