Skip to content

Support spring.webflux.default-html-escape property for application-wide HTML escaping configuration #49623

@husseinvr97

Description

@husseinvr97

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions