Reputation: 165
I have previously used XML based configuration for my Spring app.
Now, I want to use ONLY Java-based container configuration using @Bean, @Configuration etc.
How do I convert these two pieces of XML configurations to Java based config?
<outbound-channel-adapter channel="emailChannel" ref="messageHandler">
<poller>
<interval-trigger interval="60000"/>
</poller>
</outbound-channel-adapter>
<tx:annotation-driven transaction-manager="transactionManager"/>
Upvotes: 5
Views: 2477
Reputation: 174719
Unlike the simple <bean/> syntax for Spring Beans, which can easily be replaced by @Bean java configuration, the Spring Integration XML DSL provides a rich abstraction over Spring Integration components.
In order to replace the
<outbound-channel-adapter/>
above, you would need to dig into the NamespaceHandlers, and XML parsers, to define the equivalent set of beans needed to define the equivalent @Beans. The context drives which beans are generated (for example, whether emailChannel is a subscribable, or pollable channel).
For the <tx:annotation-driven/>, the new Spring 3.1 @Enable... annotations can be used...
http://blog.springsource.org/2011/06/10/spring-3-1-m2-configuration-enhancements/
Upvotes: 4