cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r729460 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
Date Fri, 26 Dec 2008 08:33:58 GMT
Author: ningjiang
Date: Fri Dec 26 00:33:58 2008
New Revision: 729460

URL: http://svn.apache.org/viewvc?rev=729460&view=rev
Log:
CXF-1958 JAXRS Endpoint should be aware of bus which exits in the application context

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java?rev=729460&r1=729459&r2=729460&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
Fri Dec 26 00:33:58 2008
@@ -25,14 +25,22 @@
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-
+import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
+import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanDefinitionStoreException;
 import org.springframework.beans.factory.support.AbstractBeanDefinition;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+
 
 
 public class JAXRSServerFactoryBeanDefinitionParser extends AbstractBeanDefinitionParser
{
@@ -40,7 +48,7 @@
 
     public JAXRSServerFactoryBeanDefinitionParser() {
         super();
-        setBeanClass(JAXRSServerFactoryBean.class);
+        setBeanClass(SpringJAXRSServerFactoryBean.class);
     }
     
     @Override
@@ -107,5 +115,25 @@
     protected boolean hasBusProperty() {
         return true;
     }
+    
+    public static class SpringJAXRSServerFactoryBean extends JAXRSServerFactoryBean implements
+        ApplicationContextAware {
+
+        public SpringJAXRSServerFactoryBean() {
+            super();
+        }
+
+        public SpringJAXRSServerFactoryBean(JAXRSServiceFactoryBean sf) {
+            super(sf);
+        }
+
+        public void setApplicationContext(ApplicationContext ctx) throws BeansException {
+            if (getBus() == null) {
+                Bus bus = BusFactory.getThreadDefaultBus();
+                BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
+                setBus(bus);
+            }
+        }
+    }
 
 }



Mime
View raw message