Closed
Description
The following code use do work up to spring-boot 2.1.10
. But since 2.2.x the following code does not find the MessageChannel
bean anymore:
@MessageEndpoint
public class ExampleMessageEndpoint {
//creates a DirectChannel named "exampleChannel" implicit
@ServiceActivator(inputChannel = "exampleChannel")
public String example(String example) {
//...
}
}
@Configuration
@EnableIntegration
public class ExampleConfiguration {
@Bean
public TcpConnectionFactoryFactoryBean factory() throws Exception {
TcpConnectionFactoryFactoryBean f = new TcpConnectionFactoryFactoryBean();
f.setType("server");
f.setPort(port);
f.setUsingNio(true);
//...
return f;
}
//also @Qualifier("exampleChannel") does not work
@Bean
public TcpInboundGateway gateway(TcpConnectionFactoryFactoryBean f, MessageChannel c) throws Exception {
TcpInboundGateway g = new TcpInboundGateway();
g.setConnectionFactory(f.getObject());
g.setRequestChannel(c);
return g;
}
}
Error:
Parameter 1 of method gateway in ExampleConfiguration required a single bean, but 2 were found:
- nullChannel: defined in null
- errorChannel: defined in null
Of course this could be solved by simply adding a:
@Bean
public DirectChannel exampleChannel() {
return new DirectChannel();
}
But as documented, I would consider this a bug.