Java code:
public class StdioApplication {
public static void main(String[] args) {
new ClassPathXmlApplicationContext("classpath:spring/integration/stackoverflow/stdio/stdio.xml");
}
}
Xml config file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
<int:channel id="channel"/>
<int-stream:stdin-channel-adapter id="stdin" channel="channel">
<int:poller fixed-rate="1000"/>
</int-stream:stdin-channel-adapter>
<int-stream:stdout-channel-adapter id="stdout" channel="channel"/>
</beans>
This is a echo example. When you run this Java application, you can input some string and then it will be displayed on the console.