I would like to configure my service client's JsonMapper separately from the application as a whole. Right now I can do that programmatically:
@Bean
RestClientHttpServiceGroupConfigurer groupConfigurer() {
var jsonMapper = JsonMapper.builder()
.enable(ACCEPT_CASE_INSENSITIVE_ENUMS)
.enable(ACCEPT_SINGLE_VALUE_AS_ARRAY)
// etc.
.build();
var converter = new JacksonJsonHttpMessageConverter(jsonMapper);
return groups -> {
groups.filterByName("abc").forEachClient((_, builder) -> {
builder.configureMessageConverters(client -> {
client.withJsonConverter(converter);
});
});
};
}
But I would like if it could be done with a configuration property:
spring:
http:
serviceclient:
abc:
jackson: # the same properties as spring.jackson
mapper:
accept-case-insensitive-enums: true
deserialization:
accept-single-value-as-array: true
I would like to configure my service client's JsonMapper separately from the application as a whole. Right now I can do that programmatically:
But I would like if it could be done with a configuration property: