Commits

Anonymous committed b1e8491

Ensured an ObjectFactory instance will be available during configuration initialization
XW-460

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1297e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java

             }
         });
         
-        container = builder.create(false);
-        objectFactory = container.getInstance(ObjectFactory.class);
-        
-        for (ConfigurationProvider configurationProvider : providers)
-        {
-            container.inject(configurationProvider);
-            configurationProvider.loadPackages();
+        try {
+            // Set the object factory for the purposes of factory creation
+            ObjectFactory.setObjectFactory(new ObjectFactory());
+            
+            container = builder.create(false);
+            objectFactory = container.getInstance(ObjectFactory.class);
+            ObjectFactory.setObjectFactory(objectFactory);
+            
+            for (ConfigurationProvider configurationProvider : providers)
+            {
+                container.inject(configurationProvider);
+                configurationProvider.loadPackages();
+            }
+    
+            rebuildRuntimeConfiguration();
+        } finally {
+            ObjectFactory.setObjectFactory(null);
         }
-
-        rebuildRuntimeConfiguration();
     }
 
     public void removePackageConfig(String name) {