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: src/reference/asciidoc/overview.adoc
+80Lines changed: 80 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -273,6 +273,86 @@ If you need to send a messages during startup, implement `ApplicationListener` a
273
273
Alternatively, implement `SmartLifecycle`, put your bean in a late phase, and send the messages from the `start()` method.
274
274
275
275
276
+
[[shaded]]
277
+
=== Considerations When using Packaged (e.g. Shaded) Jars
278
+
279
+
Spring Integration bootstraps certain features using Spring Framework's `SpringFactories` mechanism to load several `IntegrationConfigurationInitializer` classes.
280
+
This includes the `-core` jar as well as certain others such as `-http`, `-jmx`, etc.
281
+
The information for this process is stored in a file `META-INF/spring.factories` in each jar.
282
+
283
+
Some developers prefer to repackage their application and all dependencies into a single jar using well-known tools, such as the https://maven.apache.org/plugins/maven-shade-plugin/[Apache Maven Shade Plugin].
284
+
285
+
By default, the shade plugin will not merge the `spring.factories` files when producing the shaded jar.
286
+
287
+
In addition to `spring.factories`, there are other `META-INF` files (`spring.handlers`, `spring.schemas`) used for XML configuration.
288
+
These also need to be merged.
289
+
290
+
IMPORTANT: https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html[Spring Boot's executable jar mechanism] takes a different approach in that it nests the jars, thus retaining each `spring.factories` file on the class path.
291
+
So, with a Spring Boot application, nothing more is needed, if you use its default executable jar format.
292
+
293
+
Even if you are not using Spring Boot, you can still use tooling provided by Boot to enhance the shade plugin by adding transformers for the above mentioned files.
294
+
295
+
The following is an example configuration for the plugin at the time of writing.
296
+
You may wish to consult the current https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/pom.xml[spring-boot-starter-parent pom] to see the current settings that boot uses.
0 commit comments