TcpNioServerConnectionFactory

TcpNioServerConnectionFactory

通常的java方法是:

new ServerSocket(8765,0,"192.168.178.100");


我正在使用spring TcpNioServerConnectionFactory创建套接字。如何在此处设置所需的InetAddress

最佳答案

TcpNioServerConnectionFactory公开您可以设置的localAddress属性。

<bean class="org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionFactory">
    <property name="localAddress" value="192.168.178.100" />
</bean>

07-24 09:45