1
votes

I have the following HTTP inbound gateway with XML config. How can I create the same with JAVA 8 DSL config in Spring Integration?

<int-http:inbound-gateway id="testGateWay"      
    supported-methods="GET" 
    request-channel="testRequestChannel"
    reply-channel="testResponseChannel"      
    path="/services/normalization"
/>
1

1 Answers

2
votes

Starting with version 1.1, Spring Integration Java DSL provides HTTP namespace factory. So, you can follow with existing sample from the HttpTests:

@Bean
public IntegrationFlow httpInternalServiceFlow() {
    return IntegrationFlows
            .from(Http.inboundGateway("/service/internal")
                    .requestMapping(r -> r.params("name"))
                    .payloadExpression("#requestParams.name"))
            .channel(transformSecuredChannel())
            .<List<String>, String>transform(p -> p.get(0).toUpperCase())
            .get();
}