Skip to content

Commit 4cdd7ab

Browse files
committed
If no @JsonCreator annotation is used, then use the configured creatorBinding of the parameter names module
1 parent d33533c commit 4cdd7ab

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

parameter-names/src/main/java/com/fasterxml/jackson/module/paramnames/ParameterNamesAnnotationIntrospector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public JsonCreator.Mode findCreatorAnnotation(MapperConfig<?> config, Annotated
7878
}
7979
return mode;
8080
}
81-
return null;
81+
return creatorBinding;
8282
}
8383

8484
@Override

parameter-names/src/test/java/com/fasterxml/jackson/module/paramnames/JsonCreatorTest.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import com.fasterxml.jackson.databind.*;
55
import org.junit.*;
66

7-
import java.io.IOException;
8-
97
import static org.assertj.core.api.BDDAssertions.*;
108

119
public class JsonCreatorTest
@@ -25,11 +23,10 @@ public void shouldDeserializeClassWithJsonCreatorOnStaticMethod() throws Excepti
2523
}
2624

2725
@Test
28-
public void shouldDeserializeUsingDefaultPropertyCreatorSetting() throws IOException {
26+
public void shouldDeserializeUsingDefaultPropertyCreatorSetting() throws Exception {
2927
// given
3028
ObjectMapper objectMapper = new ObjectMapper();
31-
objectMapper.registerModule(new ParameterNamesModule());
32-
objectMapper.configure(MapperFeature.SET_PROPERTY_CREATOR_AS_DEFAULT, true);
29+
objectMapper.registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));
3330
int givenValue = 1;
3431

3532
// when

0 commit comments

Comments
 (0)