Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
lukaszlenart wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from feat/WW-4291-spring-bean-type-converters

Conversation

@lukaszlenart
Copy link
Member

@lukaszlenart lukaszlenart commented Feb 1, 2026
edited
Loading

Summary

This PR implements two-phase processing for conversion properties to enable Spring bean name resolution in struts-conversion.properties files.

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 ClassNotFoundException was thrown.

Root Cause: Type converters were processed during the bootstrap phase before SpringObjectFactory was available. SpringObjectFactory.getClassInstance() already supports bean names via containsBean() check, but it wasn't being used during early initialization.

Solution: Split conversion property processing into two phases:

  • Early phase (EarlyInitializable): Process struts-default-conversion.properties only - contains class names
  • Late phase (Initializable): Process user properties (struts-conversion.properties, xwork-conversion.properties) when SpringObjectFactory is available

Changes

  • Add UserConversionPropertiesProvider interface defining the late initialization contract
  • Add UserConversionPropertiesProcessor implementing Initializable for late-phase processing
  • Modify StrutsConversionPropertiesProcessor to implement UserConversionPropertiesProvider and split init() into early/late phases
  • Register new beans in DefaultConfiguration and struts-beans.xml
  • Add alias in StrutsBeanSelectionProvider for proper dependency injection
  • Explicitly trigger late initialization in DefaultConfiguration.reloadContainer()
  • Improve JavaDocs for BeanSelectionProvider and AbstractBeanSelectionProvider

Usage After This Change

Users can now specify Spring bean names in struts-conversion.properties:

# Using Spring bean name
java.time.LocalDate=localDateConverter
# Using class name (still works - backward compatible)
java.util.UUID=com.example.UUIDConverter

Test Plan

  • Unit tests for StrutsConversionPropertiesProcessor two-phase processing
  • Integration tests for Spring bean name resolution via SpringObjectFactory
  • Run full test suite: mvn test -DskipAssembly
  • Manual verification with sample Spring application

Fixes WW-4291

🤖 Generated with Claude Code

@lukaszlenart lukaszlenart force-pushed the feat/WW-4291-spring-bean-type-converters branch from d4e170a to 995e4e2 Compare February 1, 2026 09:30
@lukaszlenart lukaszlenart force-pushed the feat/WW-4291-spring-bean-type-converters branch 3 times, most recently from 5f05abc to 4d1fd16 Compare February 1, 2026 09:37
Copy link
Contributor

@jogep jogep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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 4d1fd16 to e0d2683 Compare February 1, 2026 11:38
Copy link

sonarqubecloud bot commented Feb 1, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jogep jogep jogep approved these changes

@rgielen rgielen Awaiting requested review from rgielen

@aleksandr-m aleksandr-m Awaiting requested review from aleksandr-m

@yasserzamani yasserzamani Awaiting requested review from yasserzamani

@sdutry sdutry Awaiting requested review from sdutry

@cnenning cnenning Awaiting requested review from cnenning

@kusalk kusalk Awaiting requested review from kusalk

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /