2016-07-15 4 views
2

I持って、次のクラス:春の統合:@ServiceActivatorが動作していない

osiw:サービスの活性化剤が、私がfollowinメッセージを取得する "testChannel" のために加入していてもタフな

@Configuration 
public class SpringIntegrationTest { 

    @Bean 
    public SimpleWebServiceInboundGateway testInboundGateWay(){ 
     SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway(); 
     simpleWebServiceInboundGateway.setRequestChannelName("testChannel"); 
     simpleWebServiceInboundGateway.setReplyChannelName("testChannel2"); 
     return simpleWebServiceInboundGateway; 
    } 

    @Bean 
    public MessageChannel testChannel() { 
     return new DirectChannel(); 
    } 

    @Bean 
    public MessageChannel testChannel2() { 
     return new DirectChannel(); 
    } 

    @ServiceActivator(inputChannel = "testChannel", outputChannel = "testChannel2") 
    public DOMSource foo(DOMSource request) { 
     System.out.println("asd"); 
     return request; 
    } 

    @Bean 
    public EndpointMapping soapActionEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay) { 
     UriEndpointMapping uriEndpointMapping = new UriEndpointMapping(); 
     uriEndpointMapping.setUsePath(true); 
     uriEndpointMapping.setEndpointMap(createEndpointMapping(testInboundGateWay)); 
     return uriEndpointMapping; 
    } 

    private Map<String, Object> createEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay) { 
     Map<String, Object> endpointMap = new HashMap<>(); 
     endpointMap.put("/ws/test", testInboundGateWay); 
     return endpointMap; 
    } 

} 

SimpleWebServiceInboundGateway - ゲートウェイでエラーが発生しました。sendAndReceive:Dispatcherにチャネル 'org.springframework.web.context.WebApplicationContext:/ MyProject restful API.testChannel'のサブスクライバがありません。入れ子にされた例外はorg.springframework.integration.MessageDispatchingExceptionです:Dispatcherにサブスクライバがありません

私は間違っていますか?

答えて

4

設定クラスの1つに@EnableIntegrationを追加する必要があります。

0

ディスパッチャをtestChannelに追加すると、この問題が解決されます。

関連する問題