Skip to content

Commit 2099093

Browse files
committed
Merge branch '2.0.x' into 2.1.x
2 parents a569f36 + b8cbd0c commit 2099093

File tree

1 file changed

+9
-4
lines changed
  • spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json

1 file changed

+9
-4
lines changed

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonExcludeFilter.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,13 +20,12 @@
2020
import java.util.LinkedHashSet;
2121
import java.util.Set;
2222

23-
import com.fasterxml.jackson.databind.Module;
24-
2523
import org.springframework.boot.context.TypeExcludeFilter;
2624
import org.springframework.boot.jackson.JsonComponent;
2725
import org.springframework.boot.test.autoconfigure.filter.AnnotationCustomizableTypeExcludeFilter;
2826
import org.springframework.context.annotation.ComponentScan.Filter;
2927
import org.springframework.core.annotation.AnnotatedElementUtils;
28+
import org.springframework.util.ClassUtils;
3029

3130
/**
3231
* {@link TypeExcludeFilter} for {@link JsonTest @JsonTest}.
@@ -35,11 +34,17 @@
3534
*/
3635
class JsonExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
3736

37+
private static final String JACKSON_MODULE = "com.fasterxml.jackson.databind.Module";
38+
3839
private static final Set<Class<?>> DEFAULT_INCLUDES;
3940

4041
static {
4142
Set<Class<?>> includes = new LinkedHashSet<>();
42-
includes.add(Module.class);
43+
try {
44+
includes.add(ClassUtils.forName(JACKSON_MODULE, null));
45+
}
46+
catch (Exception ex) {
47+
}
4348
includes.add(JsonComponent.class);
4449
DEFAULT_INCLUDES = Collections.unmodifiableSet(includes);
4550
}

0 commit comments

Comments
 (0)