You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This guide walks you through the process of using Spring Integration to create a
18
18
19
19
== What you'll build
20
20
21
-
You'll create a flow using Spring Integration.
21
+
You'll create a flow with Spring Integration using traditional XML configuration.
22
22
23
23
== What you'll need
24
24
@@ -59,9 +59,14 @@ This simple flow is illustrated like this:
59
59
60
60
image::images/blogToFile.png[A flow that reads RSS feed entries, transforms them to a String, and appends them to a file.]
61
61
62
+
Ignore the `auto-startup` attribute for now; we'll revisit that later when discussing testing; just notice that it will be `true` by default which means the posts will be fetched when the application starts.
63
+
62
64
== Make the application executable
63
65
64
-
Although it is common to configure a Spring Integration flow within a larger application, perhaps even a web application, there's no reason that it can't be defined in a simpler standalone application. That's what you do next, creating a main class that kicks off the integration flow and also declares a handful of beans to support the integration flow. You also build the application into a standalone executable JAR file. We use Spring Boot's `SpringApplication` to create the application context.
66
+
Although it is common to configure a Spring Integration flow within a larger application, perhaps even a web application, there's no reason that it can't be defined in a simpler standalone application.
67
+
That's what you do next, creating a main class that kicks off the integration flow and also declares a handful of beans to support the integration flow. You also build the application into a standalone executable JAR file.
68
+
We use Spring Boot's `SpringApplication` to create the application context.
69
+
Since this guide uses an the XML namespace for the integration flow, notice that we use `@ImportResource` to load it into the application context.
65
70
66
71
67
72
`src/main/java/hello/Application.java`
@@ -100,8 +105,28 @@ Spring Integration Java DSL: Line by line tutorial @ https://spring.io/blog/2014
100
105
Spring for Apache Hadoop 2.1.0.M2 Released @ https://spring.io/blog/2014/11/14/spring-for-apache-hadoop-2-1-0-m2-released
101
106
....
102
107
108
+
== Testing
109
+
110
+
Examine the `complete` project and you will see a test case.
This uses Spring Boot's test support to set a property `test.auto.startup` to `false`.
119
+
It is generally not a good idea to rely on a network connection for tests, especially in a CI environment.
120
+
So, instead, we prevent the feed adapter from starting and inject a `SyndEntry` into the `news` channel for processing by the rest of the flow.
121
+
The test
122
+
123
+
- verifies the adapter is stopped
124
+
- creates a test `SyndEntry`
125
+
- deletes the output file (if it's present)
126
+
- sends the message
127
+
- reads the file and verifies that the data is as expected
128
+
103
129
== Summary
104
130
Congratulations! You have developed a simple application that uses Spring Integration to fetch blog posts from spring.io, process them, and write them to a file.
0 commit comments