Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/core-developers/constant-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ You can also define a default value if given System property or ENV variable is
</struts>
```

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

Expand Down
16 changes: 12 additions & 4 deletions source/core-developers/package-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<constant>`, `${...}` [value substitution](constant-configuration#value-substitution)
is not supported.
Values support the same `${...}` [value substitution](constant-configuration#value-substitution) as `<constant>`.
System properties and environment variables are resolved once, when the configuration loads, and the resulting
value is static:

```xml
<package name="admin" extends="struts-default" namespace="/admin">
<scoped-constant name="some.scopable.constant" value="${env.ADMIN_VALUE:x}"/>
...
</package>
```

### Making a constant scopable

Expand Down Expand Up @@ -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(...)`.