2
votes

doc says : The new DirectChannel bean will be created on context startup if there is no bean with this name.

 @MessagingGateway
    public interface Responder {

        @Gateway(requestChannel = "request.input")
        String respond(String request);

    }

    @Bean
    public IntegrationFlow doResponse(){

        return IntegrationFlows
            .from("request.input")
            .transform("payload")
            .get();

    }

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {IntegrationConfiguration.class})
public class GatewayTests {

    @Autowired Responder responder;

    @Test
    public void test(){

        responder.respond("request");

    }

}

this results in : No bean named 'request.input' is defined have i left something out which triggers the channel creation ?

spring-boot : 1.1.9.RELEASE spring-integration-java-dsl : 1.0.0.RELEASE spring-integration : 4.0.4.RELEASE

1
ok, my mistake i think : IntegrationComponentScan does not create channels for MessagingGatewaywims.tijd
Ok, I am completely lost. Where does the IntegrationFlow know to invoke the Responder?pojo-guy

1 Answers

3
votes

You should be sure that Spring Integration infrastructure is swtiched on: @EnableIntegration on the @Configuration class, or @EnableAutoConfiguration if you use Spring Boot.

From other side not all auto-channel features works with Spring Integration 4.0.x.

With that you always can overcome the issue with explicit MessageChannel @Bean.