Repository navigation
WW-5766 Support struts.scopedConstantProvider in Java-based configuration - #2006
Merged
Merged
Conversation
…nfig Java-based configuration can now select a custom ScopedConstantProvider through ConstantConfig instead of overriding getAllAsStringsMap(). The selection tests load providers in the Dispatcher's order rather than through StrutsDefaultConfigurationProvider: that bootstrap binds ScopedConstantProvider under the default name, so alias() skips the constant and the test could never observe the mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lukaszlenart
marked this pull request as ready for review
October 12, 2026 09:25
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes WW-5766
Summary
Java-based configuration (
StrutsJavaConfiguration) can now select a customScopedConstantProvider. Before this change the only way was to subclassConstantConfigand overridegetAllAsStringsMap().ConstantConfiggets ascopedConstantProviderfield, mapped tostruts.scopedConstantProvideringetAllAsStringsMap(). It has a getter and two setters, following thelocalizedTextProvidermapping. The class setter takesClass<? extends ScopedConstantProvider>rather than the file's usualClass<?>, so a wrong class is caught at compile time.Tests
ConstantConfigTest.testScopedConstantProviderToString: the key is absent until set, then maps to the bean name from either setter.StrutsJavaConfigurationProviderTest.testScopedConstantProviderSelectedThroughConstantConfig: a custom provider registered throughbeans()and selected throughConstantConfigis the one the container returns.StrutsJavaConfigurationProviderTest.testScopableConstantsBeanSatisfiesScopedConstantValidation: aScopableConstantsbean registered throughbeans()lets an XML package's<scoped-constant>pass startup validation. This already worked and had no test.The two integration tests load providers in the same order as
Dispatcher: default properties,struts-default.xml, the Java config, thenStrutsBeanSelectionProvider. They don't useStrutsDefaultConfigurationProvider, because it bindsScopedConstantProviderunder the default name. With that binding,alias()skips the constant, so the test could never see the mapping.I checked that the tests aren't vacuous. With the
map.putline removed, both mapping tests fail. With theScopableConstantsbean removed, the validation test fails with "declares scoped constant [sample.scopable], which is not scopable". The fullcoresuite passes: 3446 tests, 0 failures.Out of scope
StrutsJavaConfigurationhas no package concept.ConstantConfigdoesn't map either (parameterAuthorizer,ognlGuard,proxyService, ...).🤖 Generated with Claude Code