cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1091104 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring: BusExtensionPostProcessor.java SpringBus.java
Date Mon, 11 Apr 2011 15:50:24 GMT
Author: dkulp
Date: Mon Apr 11 15:50:24 2011
New Revision: 1091104

URL: http://svn.apache.org/viewvc?rev=1091104&view=rev
Log:
[CXF-3447] Don't get teh Bus unless really needed.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java?rev=1091104&r1=1091103&r2=1091104&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
Mon Apr 11 15:50:24 2011
@@ -21,7 +21,6 @@ package org.apache.cxf.bus.spring;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
-import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.extension.BusExtension;
 
 import org.springframework.beans.BeansException;
@@ -51,9 +50,11 @@ public class BusExtensionPostProcessor i
 
     @SuppressWarnings("unchecked")
     public Object postProcessBeforeInitialization(Object bean, String beanId) throws BeansException
{
-        if (null != getBus() && bean instanceof BusExtension) {
+        if (bean instanceof BusExtension && null != getBus()) {
             Class cls = ((BusExtension)bean).getRegistrationType();
             getBus().setExtension(bean, cls);
+        } else if (bean instanceof Bus && Bus.DEFAULT_BUS_ID.equals(beanId)) {
+            bus = (Bus)bean;
         }
         return bean;
     }
@@ -61,11 +62,6 @@ public class BusExtensionPostProcessor i
     private Bus getBus() {
         if (bus == null) {
             bus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
-            bus.setExtension(context, ApplicationContext.class);
-            ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
-            if (!(loc instanceof SpringBeanLocator)) {
-                bus.setExtension(new SpringBeanLocator(context, bus), ConfiguredBeanLocator.class);
-            }
         }
         return bus;
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1091104&r1=1091103&r2=1091104&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java Mon Apr 11 15:50:24
2011
@@ -21,6 +21,7 @@ package org.apache.cxf.bus.spring;
 
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
 import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.apache.cxf.resource.ResourceManager;
@@ -60,6 +61,12 @@ public class SpringBus extends Extension
         
         ResourceManager m = getExtension(ResourceManager.class);
         m.addResourceResolver(new BusApplicationContextResourceResolver(applicationContext));
+        
+        setExtension(applicationContext, ApplicationContext.class);
+        ConfiguredBeanLocator loc = getExtension(ConfiguredBeanLocator.class);
+        if (!(loc instanceof SpringBeanLocator)) {
+            setExtension(new SpringBeanLocator(applicationContext, this), ConfiguredBeanLocator.class);
+        }
     }
 
     public void onApplicationEvent(ApplicationEvent event) {



Mime
View raw message