-
Notifications
You must be signed in to change notification settings - Fork 836
WW-4291 Allow Spring bean names for type converters #1562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Conversation
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
@lukaszlenart
lukaszlenart
force-pushed
the
feat/WW-4291-spring-bean-type-converters
branch
from
February 1, 2026 09:30
d4e170a to
995e4e2
Compare
@lukaszlenart
lukaszlenart
requested review from
aleksandr-m,
cnenning,
jogep,
kusalk,
rgielen,
sdutry and
yasserzamani
February 1, 2026 09:30
@lukaszlenart
lukaszlenart
force-pushed
the
feat/WW-4291-spring-bean-type-converters
branch
3 times, most recently
from
February 1, 2026 09:37
5f05abc to
4d1fd16
Compare
jogep
jogep
approved these changes
Feb 1, 2026
Contributor
@jogep
jogep
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java
Show resolved
Hide resolved
Implement two-phase processing for conversion properties to enable Spring bean name resolution in struts-conversion.properties files. The issue was a timing problem: type converters were processed during bootstrap phase before SpringObjectFactory was available. Now: - Early phase: process struts-default-conversion.properties (class names) - Late phase: process user properties when SpringObjectFactory is ready Changes: - Add UserConversionPropertiesProvider interface for late initialization - Add UserConversionPropertiesProcessor to trigger late phase processing - Split StrutsConversionPropertiesProcessor.init() into early/late phases - Register new beans in DefaultConfiguration and struts-beans.xml - Add alias in StrutsBeanSelectionProvider for dependency injection - Improve JavaDocs for BeanSelectionProvider classes Closes WW-4291 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@lukaszlenart
lukaszlenart
force-pushed
the
feat/WW-4291-spring-bean-type-converters
branch
from
February 1, 2026 11:38
4d1fd16 to
e0d2683
Compare
Quality Gate Passed Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
97.1% Coverage on New Code
0.0% Duplication on New Code
4 tasks
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.
Uh oh!
There was an error while loading. Please reload this page.
Summary
This PR implements two-phase processing for conversion properties to enable Spring bean name resolution in
struts-conversion.propertiesfiles.Problem: Users could not reference Spring bean names in conversion properties. When specifying a bean name (e.g., "myConverter") instead of a fully qualified class name, a
ClassNotFoundExceptionwas thrown.Root Cause: Type converters were processed during the bootstrap phase before
SpringObjectFactorywas available.SpringObjectFactory.getClassInstance()already supports bean names viacontainsBean()check, but it wasn't being used during early initialization.Solution: Split conversion property processing into two phases:
struts-default-conversion.propertiesonly - contains class namesstruts-conversion.properties,xwork-conversion.properties) whenSpringObjectFactoryis availableChanges
UserConversionPropertiesProviderinterface defining the late initialization contractUserConversionPropertiesProcessorimplementingInitializablefor late-phase processingStrutsConversionPropertiesProcessorto implementUserConversionPropertiesProviderand splitinit()into early/late phasesDefaultConfigurationandstruts-beans.xmlStrutsBeanSelectionProviderfor proper dependency injectionDefaultConfiguration.reloadContainer()BeanSelectionProviderandAbstractBeanSelectionProviderUsage After This Change
Users can now specify Spring bean names in
struts-conversion.properties:Test Plan
StrutsConversionPropertiesProcessortwo-phase processingSpringObjectFactorymvn test -DskipAssemblyFixes WW-4291
🤖 Generated with Claude Code