From b37d8d416dc2a2c82cf15b8506b8d963103d13bf Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Mon, 12 Oct 2026 20:03:38 +0200 Subject: [PATCH] WW-5767 docs: document value substitution in scoped constants Scoped constant values now go through the same ${...} substitution as . Also drop the note that Java-based configuration cannot select struts.scopedConstantProvider, fixed by WW-5766. Co-Authored-By: Claude Opus 5.5 --- source/core-developers/constant-configuration.md | 3 ++- source/core-developers/package-configuration.md | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/source/core-developers/constant-configuration.md b/source/core-developers/constant-configuration.md index 06e20b205..db63af749 100644 --- a/source/core-developers/constant-configuration.md +++ b/source/core-developers/constant-configuration.md @@ -54,7 +54,8 @@ You can also define a default value if given System property or ENV variable is ``` -Note: substitution is limited to System properties and ENV variables and works only for `constant`s (as for now). +Note: substitution is limited to System properties and ENV variables. It works for `constant`s and, since Struts 7.5.0, +for [`scoped-constant`s](package-configuration#scoped-constants). ## Examples diff --git a/source/core-developers/package-configuration.md b/source/core-developers/package-configuration.md index f4d7da2bd..62072b2bc 100644 --- a/source/core-developers/package-configuration.md +++ b/source/core-developers/package-configuration.md @@ -127,8 +127,16 @@ The configuration is validated at startup, and loading fails when: The error message lists the scopable constants that are available. - a package declares the same constant more than once. -Values are used as they are. Unlike in ``, `${...}` [value substitution](constant-configuration#value-substitution) -is not supported. +Values support the same `${...}` [value substitution](constant-configuration#value-substitution) as ``. +System properties and environment variables are resolved once, when the configuration loads, and the resulting +value is static: + +```xml + + + ... + +``` ### Making a constant scopable @@ -192,5 +200,5 @@ Do not declare security-related constants scopable, such as `struts.parameters.r meant to protect the whole application. The default `ScopedConstantProvider` implementation can be replaced with the `struts.scopedConstantProvider` -[extension point](../plugins/plugins-architecture#extension-points). For now this works only from XML or -properties configuration. Java-based configuration cannot set it yet. +[extension point](../plugins/plugins-architecture#extension-points). Java-based configuration sets it with +`ConstantConfig.setScopedConstantProvider(...)`.