user1552545
user1552545

Reputation: 1331

How can I create http:inbound-gateway with JAVA DSL config?

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"
/>

Upvotes: 1

Views: 1203

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121442

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();
}

Upvotes: 2

Related Questions