Reputation: 4719
Is it possible to define, within XML, a standard Spring Integration bean as an abstract bean which can be overridden. The idea of course would be to minimize configuration.
For instance, say one needs several jms:message-driven-adapter beans, all which share some common properties. How could one define an abstract bean with those properties, and then override it with concrete beans which have just the parameters which are different between each instance? Thanks
Upvotes: 0
Views: 264
Reputation: 174484
You cannot do it with the namespace; but the JMS message-driven adapter is a relatively simple component that you can define with normal <bean/>
syntax. You would need to wire together a JmsMessageDrivenEndpoint
which takes an AbstractMessageListenerContainer
(DefaultMessageListenerContainer
) and a ChannelPublishingJmsMessageListener
in its constructor.
In general, taking a look at the namespace parser for each component will tell you what <bean/>
s to define.
Another technique is to define a "mini" application context defining the endpoint with property placeholders and then create a new instance of the context each time, making the main context the parent.
The general technique is explored for outbound ftp endpoints in this sample. However, it does not make its contexts children (because it's not needed there). However, the README has a link to a forum thread that explains that mechanism, when used for dynamic inbound endpoints.
Upvotes: 2