-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Overview
This issue is a followup to gh-23002.
The documentation for spring.ftl
in spring-webflux
states the following.
To take advantage of these macros, the "requestContextAttribute" property of the FreeMarkerView class must be set to "springMacroRequestContext". This will expose a RequestContext under the name "springMacroRequestContext", as needed by the macros in this library.
Although this technically works, it is not as user-friendly as the analogous support in spring-webmvc
. Specifically, AbstractTemplateView
(in spring-webmvc
) provides a dedicated exposeSpringMacroHelpers
flag for automatically exposing the RequestContext
as a model attribute for consumption in FreeMarker templates. Since this boolean flag defaults to true
, users do not have to configure anything special in FreeMarkerView
to use all supported macros.
In contrast, users of FreeMarkerView
in spring-webflux
cannot use all supported macros unless they explicitly set the requestContextAttribute
property of the FreeMarkerView
to "springMacroRequestContext"
.
I think this is cumbersome and should be improved.
Deliverables
- Consider introducing a dedicated
exposeSpringMacroHelpers
flag in template-based views inspring-webflux
analogous to the support inspring-webmvc
.