lukaszlenart opened a new pull request, #1562: URL: https://github.com/apache/struts/pull/1562
## 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`: ```properties # Using Spring bean name java.time.LocalDate=localDateConverter # Using class name (still works - backward compatible) java.util.UUID=com.example.UUIDConverter ``` ## Test Plan - [x] Unit tests for `StrutsConversionPropertiesProcessor` two-phase processing - [x] 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](https://issues.apache.org/jira/browse/WW-4291) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
