-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Description
Spring Framework 7.0.6 introduced programmatic support for configuring
application-wide HTML escaping in WebFlux via WebHttpHandlerBuilder.defaultHtmlEscape()
(see spring-projects/spring-framework#36400).
However, Spring Boot does not yet expose this as a property, meaning developers
cannot configure it via application.properties or application.yml.
In Spring MVC, this has long been configurable via the defaultHtmlEscape
context parameter in web.xml. WebFlux applications migrating from MVC
currently have no equivalent property-based option.
Proposed Solution
Add spring.webflux.default-html-escape to WebFluxProperties and wire it
through a WebHttpHandlerBuilderCustomizer bean in WebFluxAutoConfiguration:
spring.webflux.default-html-escape=true
This follows the existing WebHttpHandlerBuilderCustomizer extension point
already used in HttpHandlerAutoConfiguration.
I can submit a PR for this change.
Reference
- Spring Framework PR: Support application-wide defaultHtmlEscape setting in WebFlux RequestContext spring-framework#36400
- Spring Framework commit: d4893fb