diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java b/core/src/main/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java index 2770c48b0..d945e0a26 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java @@ -55,6 +55,10 @@ public class DefaultValidatorFactory implements ValidatorFactory { public DefaultValidatorFactory(@Inject ObjectFactory objectFactory, @Inject ValidatorFileParser parser) { this.objectFactory = objectFactory; this.validatorFileParser = parser; + } + + @Override + public void init() { parseValidators(); } diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/ValidatorFactory.java b/core/src/main/java/com/opensymphony/xwork2/validator/ValidatorFactory.java index 8510fe6bb..5c3ce7ed4 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/ValidatorFactory.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/ValidatorFactory.java @@ -18,6 +18,8 @@ */ package com.opensymphony.xwork2.validator; +import com.opensymphony.xwork2.inject.Initializable; + /** * ValidatorFactory * @@ -225,7 +227,7 @@ package com.opensymphony.xwork2.validator; * @author Jason Carreira * @author James House */ -public interface ValidatorFactory { +public interface ValidatorFactory extends Initializable { /** * Get a Validator that matches the given configuration. diff --git a/core/src/test/java/com/opensymphony/xwork2/spring/SpringObjectFactoryTest.java b/core/src/test/java/com/opensymphony/xwork2/spring/SpringObjectFactoryTest.java index 0f6e52cf0..776bd791b 100644 --- a/core/src/test/java/com/opensymphony/xwork2/spring/SpringObjectFactoryTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/spring/SpringObjectFactoryTest.java @@ -66,6 +66,10 @@ public class SpringObjectFactoryTest extends XWorkTestCase { @Override public void register(ContainerBuilder builder, LocatableProperties props) throws ConfigurationException { + + // No registered beans during initialization; They will be registered in each test, runtime. + props.setProperty("applicationContextPath", "com/opensymphony/xwork2/spring/emptyContext-spring.xml"); + builder.factory(ObjectFactory.class, SpringObjectFactory.class); } diff --git a/core/src/test/resources/com/opensymphony/xwork2/spring/emptyContext-spring.xml b/core/src/test/resources/com/opensymphony/xwork2/spring/emptyContext-spring.xml new file mode 100644 index 000000000..41a2b5db9 --- /dev/null +++ b/core/src/test/resources/com/opensymphony/xwork2/spring/emptyContext-spring.xml @@ -0,0 +1,25 @@ + + + + + +