Skip to content

Improve configuration API of ClientCodecConfigurer.CustomCodecs #24124

@odrotbohm

Description

@odrotbohm

The 5.2.2 release includes new API to allow custom decoders to be registered to use the default configuration for decoders. There are a few things that could be improved about that.

  1. The method one has to work with is named withDefaultConfig(…) and takes a Consumer. Wither methods usually return a new instance of the object being called on taking the argument into account. This one here simply provides a configuration abstraction I now have to use to configure my own decoder.
  2. DefaultCodecConfig's maxInMemorySize() returns a nullable Integer. setMaxInMemorySize(…) takes an int. Looks like everyone trying to use those methods will now have to repeat the same null check before copying the value over.
  3. In general I wonder how the current programming model reacts to additional configuration exposed by DefaultCodecConfig. As it's user code that is responsible to copy properties from left to right, new options will not automatically propagated unless the developer finds out about that new property and adds the necessary line of copying.

Have you though about a CustomCodecs.decoderWithDefaultConfig(…) that register the given Decoder applying all applicable defaults? That especially would free developers from having to play catch up with new options added and also resolve the null checks needed for every client.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions