mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-22 00:29:01 +00:00
Remove duplicated default in manual Jackson metadata
Closes gh-49797
This commit is contained in:
+9
-13
@@ -326,19 +326,15 @@ public class JacksonAutoConfiguration {
|
||||
|
||||
private void configureConstructorDetector(Jackson2ObjectMapperBuilder builder) {
|
||||
ConstructorDetectorStrategy strategy = this.jacksonProperties.getConstructorDetector();
|
||||
if (strategy != null) {
|
||||
builder.postConfigurer((objectMapper) -> {
|
||||
switch (strategy) {
|
||||
case USE_PROPERTIES_BASED ->
|
||||
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
|
||||
case USE_DELEGATING ->
|
||||
objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
|
||||
case EXPLICIT_ONLY ->
|
||||
objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
|
||||
default -> objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.postConfigurer((objectMapper) -> {
|
||||
switch (strategy) {
|
||||
case USE_PROPERTIES_BASED ->
|
||||
objectMapper.setConstructorDetector(ConstructorDetector.USE_PROPERTIES_BASED);
|
||||
case USE_DELEGATING -> objectMapper.setConstructorDetector(ConstructorDetector.USE_DELEGATING);
|
||||
case EXPLICIT_ONLY -> objectMapper.setConstructorDetector(ConstructorDetector.EXPLICIT_ONLY);
|
||||
default -> objectMapper.setConstructorDetector(ConstructorDetector.DEFAULT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class JacksonProperties {
|
||||
* Strategy to use to auto-detect constructor, and in particular behavior with
|
||||
* single-argument constructors.
|
||||
*/
|
||||
private ConstructorDetectorStrategy constructorDetector;
|
||||
private ConstructorDetectorStrategy constructorDetector = ConstructorDetectorStrategy.DEFAULT;
|
||||
|
||||
/**
|
||||
* Time zone used when formatting dates. For instance, "America/Los_Angeles" or
|
||||
|
||||
-4
@@ -1854,10 +1854,6 @@
|
||||
"name": "spring.info.git.location",
|
||||
"defaultValue": "classpath:git.properties"
|
||||
},
|
||||
{
|
||||
"name": "spring.jackson.constructor-detector",
|
||||
"defaultValue": "default"
|
||||
},
|
||||
{
|
||||
"name": "spring.jackson.datatype.enum",
|
||||
"description": "Jackson on/off features for enums."
|
||||
|
||||
Reference in New Issue
Block a user