如何在Spring集成中使用Java DSL创建ws inbound-gateway?

时间:2016-03-21 10:10:18

标签: java spring spring-integration

我有以下ws入站网关。如何使用Spring Integration Java 8 DSL进行此配置?

<int-ws:inbound-gateway id="ws-inbound-gateway"
                        request-channel="ws-request-channel"
                        reply-channel="ws-response-channel"
                        error-channel="ws-error-channel"/>

1 个答案:

答案 0 :(得分:4)

不幸的是,我没有找到这种入站网关的第一级支持,但是你可以解决这个问题,如下所示:

@Configuration
@EnableIntegration
public class IntegrationConfiguration {

    @Bean
    public SimpleWebServiceInboundGateway SimpleWebServiceInboundGateway() {
            SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway();
            // your inbound configurtion
            .....

            return simpleWebServiceInboundGateway;
        }

    @Bean
    public IntegrationFlow integrationFlow(){
            return IntegrationFlows.from(SimpleWebServiceInboundGateway())
            // your pipeline
            .....
                    .get();
        }   
    }
你的maven pom中的

不要忘记这种依赖

<dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-java-dsl</artifactId>
            <version>1.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.integration</groupId>
            <artifactId>spring-integration-ws</artifactId>
            <version>4.2.5.RELEASE</version>
        </dependency>

我希望这可以帮到你