I'm trying to create a simple TcpInboundGateway
using spring
.
But the following does not work:
@EnableIntegration
@IntegrationComponentScan
public class MyEndpoint {
@Bean
public TcpInboundGateway gateway() throws Exception {
TcpInboundGateway gate = new TcpInboundGateway();
TcpConnectionFactoryFactoryBean fact = new TcpConnectionFactoryFactoryBean();
fact.setType("server");
fact.setPort(5555);
gate.setConnectionFactory(fact.getObject());
gate.setRequestChannel(new RendezvousChannel());
return gate;
}
}
Result:
Caused by: org.springframework.beans.factory.FactoryBeanNotInitializedException: org.springframework.integration.ip.config.TcpConnectionFactoryFactoryBean does not support circular references
at org.springframework.beans.factory.config.AbstractFactoryBean.getEarlySingletonInstance(AbstractFactoryBean.java:164)
at org.springframework.beans.factory.config.AbstractFactoryBean.getObject(AbstractFactoryBean.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 31 more
What might be missing here?