-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Lines 570 to 574 in 67b1420
public Jackson2ObjectMapperBuilder modulesToInstall(Module... modules) { | |
this.modules = Arrays.asList(modules); | |
this.findWellKnownModules = true; | |
return this; | |
} |
Currently the Jackson2ObjectMapperBuilderCustomizer
is only able to replace the modules that should be installed; however, it is possible to define multiple Spring Boot Jackson2ObjectMapperBuilderCustomizer
beans that could each wish to add a Jackson module. However the later customizers will always remove the modules configured by the previous instance. It isn't possible to get the current list of modules either and extend that.
We wish to separate our customizers by their related modules/source libraries (api-docs, error-handling, ..., and the application itself).
So it would be nice if there was a addModules(toInstall)
method that would add the modules to the list instead of replacing it.
Most of the other methods such as serializers(JsonSerializer<?>...)
already work like that:
Lines 354 to 363 in 67b1420
public Jackson2ObjectMapperBuilder serializers(JsonSerializer<?>... serializers) { | |
for (JsonSerializer<?> serializer : serializers) { | |
Class<?> handledType = serializer.handledType(); | |
if (handledType == null || handledType == Object.class) { | |
throw new IllegalArgumentException("Unknown handled type in " + serializer.getClass().getName()); | |
} | |
this.serializers.put(serializer.handledType(), serializer); | |
} | |
return this; | |
} |
Thanks for your awesome work.