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
This commit is contained in:
Artem Bilan
2017-07-27 12:11:10 -04:00
parent fe60be8a18
commit 68377fedd1
2 changed files with 9 additions and 5 deletions

View File

@@ -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]

View File

@@ -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();
}