spring-projects / spring-projects/spring-boot

HttpService Client doesn't take spring.jackson properties into account

Open
#50,695 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

For an application we are building we have configured Jackson3 through some properties, notably the spring.jackson.default-property-inclusion=not_empty .

We have some HTTP Service clients in different groups and it appears as if this configuration isn't taken into account, inspecting the payload that is being send it includes null fields and empty arrays.

This is then fixed when explicitly configuring the JsonMapper for the specific group.

@Bean
public RestClientHttpServiceGroupConfigurer myGroupConfigurer(JsonMapper jsonMapper) {
    return new RestClientHttpServiceGroupConfigurer() {
        @Override
        public void configureGroups(Groups<RestClient.Builder> groups) {
            groups.filterByName("my-group")
                    .forEachClient((group, cb) ->
                            cb.configureMessageConverters(cb1 -> cb1.withJsonConverter(new JacksonJsonHttpMessageConverter(jsonMapper))));
        }
    };
}  

Am I misunderstanding the documentation, doing something wrong or is this perhaps a bug / oversight?

Versions:
Spring Boot: 4.0.6 (with the default dependency versions, no overrides)
Wiremock: 4.2.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with spring.jackson.default-property-inclusion=not_empty and an HTTP Service client group, then trace how RestClientHttpServiceGroupConfigurer creates message converters. Compare the default path with the explicit JacksonJsonHttpMessageConverter configuration shown in the report. Done means the configured Jackson properties affect grouped HTTP Service client payloads without per-group converter configuration, with a regression test covering null fields and empty arrays.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.