2016-07-18 8 views
1

私はXML設定で次のHTTP受信ゲートウェイを持っています。 Spring IntegrationでJAVA 8 DSL設定で同じものを作成するにはどうすればいいですか?バージョン1.1以降でJAVA DSL設定でhttp:inbound-gatewayを作成するにはどうすればよいですか?

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

答えて

1

、春の統合JavaのDSLはHTTP名前空間の工場を提供します。したがって、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(); 
} 
関連する問題