You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2025/08/20 04:46:25 UTC
(struts) 01/01: Fixup StrutsConverterFactory
This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch fix/WW-5524-converter-factory-s6
in repository https://gitbox.apache.org/repos/asf/struts.git
commit 92a2a4bcc12f4bc4456bee1c4c88e6e4329a4409
Author: Martin Ashby <ma...@ashbysoft.com>
AuthorDate: Thu Aug 7 22:42:23 2025 +0100
Fixup StrutsConverterFactory
It should delegate back to ObjectFactory#buildBean instead of directly
calling Container#inject, otherwise overrides of buildBean in subclasses
of ObjectFactory e.g. SpringObjectFactory are skipped; meaning that
TypeConverters cannot make use of Spring dependency injection
Fixes: https://issues.apache.org/jira/projects/WW/issues/WW-5524
---
.../com/opensymphony/xwork2/factory/StrutsConverterFactory.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/core/src/main/java/com/opensymphony/xwork2/factory/StrutsConverterFactory.java b/core/src/main/java/com/opensymphony/xwork2/factory/StrutsConverterFactory.java
index 2c873e60b..e608c5a31 100644
--- a/core/src/main/java/com/opensymphony/xwork2/factory/StrutsConverterFactory.java
+++ b/core/src/main/java/com/opensymphony/xwork2/factory/StrutsConverterFactory.java
@@ -33,16 +33,15 @@ public class StrutsConverterFactory implements ConverterFactory {
private static final Logger LOG = LogManager.getLogger(StrutsConverterFactory.class);
- private Container container;
+ private ObjectFactory objectFactory;
@Inject
- public void setContainer(Container container) {
- this.container = container;
+ public void setObjectFactory(ObjectFactory objectFactory) {
+ this.objectFactory = objectFactory;
}
public TypeConverter buildConverter(Class<? extends TypeConverter> converterClass, Map<String, Object> extraContext) throws Exception {
LOG.debug("Creating converter of type [{}]", converterClass.getCanonicalName());
- return container.inject(converterClass);
+ return (TypeConverter)objectFactory.buildBean(converterClass, extraContext);
}
-
}