From 68377fedd186e0f12ea8ad5cf00cc233f6e44f04 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 27 Jul 2017 12:11:10 -0400 Subject: [PATCH] Exclude `jackson-module-kotlin` to avoid CP issue The `Jackson2JsonObjectMapper` tries to load any available modules for the Jackson `ObjectMapper` via `findAndRegisterModules()`. But if we have a module but don't have a target library, we end up with the `ClassNotFoundException`. In our case we fail with the Kotlin because Spring Boot provides `com.fasterxml.jackson.module:jackson-module-kotlin` dependency and leaves the rest of required libs for the target application. * Exclude `com.fasterxml.jackson.module:jackson-module-kotlin` from all the dependencies. * Spring Integration `Jackson2JsonObjectMapper` should be revised to use `Jackson2ObjectMapperBuilder` - https://jira.spring.io/browse/INT-4318 --- build.gradle | 4 ++++ .../samples/si4demo/annotations/Application.java | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index c1047c6c..f3d5ba80 100644 --- a/build.gradle +++ b/build.gradle @@ -245,6 +245,10 @@ subprojects { subproject -> testCompile "org.springframework:spring-test" } + configurations { + all*.exclude group: 'com.fasterxml.jackson.module', module: 'jackson-module-kotlin' + } + // enable all compiler warnings; individual projects may customize further ext.xLintArg = '-Xlint:all,-options' [compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg] diff --git a/dsl/si4demo/src/main/java/org/springframework/integration/samples/si4demo/annotations/Application.java b/dsl/si4demo/src/main/java/org/springframework/integration/samples/si4demo/annotations/Application.java index ea7246ae..e0942092 100644 --- a/dsl/si4demo/src/main/java/org/springframework/integration/samples/si4demo/annotations/Application.java +++ b/dsl/si4demo/src/main/java/org/springframework/integration/samples/si4demo/annotations/Application.java @@ -123,8 +123,8 @@ public class Application { // } @Bean - @Transformer(inputChannel="requestChannel", outputChannel="searchChannel") - public org.springframework.integration.transformer.Transformer converttoString() { + @Transformer(inputChannel = "requestChannel", outputChannel = "searchChannel") + public org.springframework.integration.transformer.Transformer convertToString() { return new ObjectToStringTransformer(); } @@ -134,7 +134,7 @@ public class Application { } @Bean - @ServiceActivator(inputChannel="searchChannel") + @ServiceActivator(inputChannel = "searchChannel") public TwitterSearchOutboundGateway twitterGate() { TwitterSearchOutboundGateway gateway = new TwitterSearchOutboundGateway(twitter()); gateway.setOutputChannel(toJsonChannel()); @@ -147,8 +147,8 @@ public class Application { } @Bean - @Transformer(inputChannel="toJsonChannel") - public org.springframework.integration.transformer.Transformer converttoJson() { + @Transformer(inputChannel = "toJsonChannel") + public org.springframework.integration.transformer.Transformer convertToJson() { return new ObjectToJsonTransformer(); }