Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move spring.http.* configuration properties namespace #18827

Closed
bclozel opened this issue Oct 31, 2019 · 2 comments
Closed

Move spring.http.* configuration properties namespace #18827

bclozel opened this issue Oct 31, 2019 · 2 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Oct 31, 2019

The current arrangement with our spring.http configuration properties namespace feels a bit odd.

Currently, we have:

  • spring.http.log-request-details, which enables logging for HTTP requests on the DispatcherServlet (params and headers depending on the logging level). It also enables logging details for multipart and form HTTP requests on both server and client for WebFlux.
  • spring.http.encoding.* properties are configuring a character encoding Servlet filter for Servlet applications, and also configuring the MVC HTTP message readers (both server and client).

This namespace is mixing client, server, Servlet, MVC and webflux concerns, making it hard to understand what's being configured.

Proposal

We could move spring.http.encoding.* to server.servlet.encoding.*, making it obvious that it's mostly for server and Servlet only. Right now we are applying that preference to the String HTTP message reader for RestTemplate and MVC server, but since we are UTF-8 by default, I'm wondering if creating an dedicated property is really worth it.

We could also move spring.http.log-request-details to spring.mvc.log-request-details, since most properties in that namespace already apply to the DispatcherServlet.

For the reactive codecs support (client and server), we're mostly targeting classes in org.springframework.http.codec for Spring Framework (Spring Core and Web). I think a spring.http.codec namespace is a good choice and aligns with a possible implementation for both spring.http.codec.log-request-details and the upcoming spring.http.codec.max-in-memory-size.

@bclozel bclozel added type: enhancement A general enhancement for: team-attention An issue we'd like other members of the team to review labels Oct 31, 2019
@bclozel bclozel self-assigned this Oct 31, 2019
@philwebb philwebb added this to the 2.3.x milestone Oct 31, 2019
@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Oct 31, 2019
@bclozel
Copy link
Member Author

bclozel commented Oct 31, 2019

Since the codecs configuration is common to reactive HTTP server/client, but also other use cases like RSocket - we should have spring.codec instead of spring.http.codec.

Also, CodecsAutoConfiguration is in org.springframework.boot.autoconfigure.http.codec and we probably should move it to org.springframework.boot.autoconfigure.codec.

@bclozel bclozel changed the title Rework "spring.http.*" configuration properties namespace Move spring.http.* configuration properties namespace Jan 14, 2020
@bclozel
Copy link
Member Author

bclozel commented Jan 14, 2020

So to summarize the configuration changes:

  • spring.http.encoding.* -> server.servlet.encoding.*
  • spring.http.log-request-details -> spring.mvc.log-request-details (Spring MVC) or spring.codec.log-request-details (Spring WebFlux)
  • spring.http.converters.preferred-json-mapper -> spring.mvc.converters.preferred-json-mapper

Those changes are in the configuration metadata so tools and IDEs can help with the migration.

@bclozel bclozel modified the milestones: 2.3.x, 2.3.0.M1 Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants