cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r789704 - in /cxf/trunk/rt/core/src/main: java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java resources/META-INF/cxf/cxf.xml
Date Tue, 30 Jun 2009 13:13:33 GMT
Author: dkulp
Date: Tue Jun 30 13:13:33 2009
New Revision: 789704

URL: http://svn.apache.org/viewvc?rev=789704&view=rev
Log:
[CXF-2210] Change JSR250BeanPostProcess to check the context itself to
see if Spring is handling the JSR250 annotations.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
    cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java?rev=789704&r1=789703&r2=789704&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
Tue Jun 30 13:13:33 2009
@@ -24,9 +24,7 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.Resource;
 
-import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.resource.ResourceManager;
@@ -45,18 +43,20 @@
     
     private ApplicationContext context;
 
-    private Bus bus;
+    private boolean isProcessing = true;
     
     Jsr250BeanPostProcessor() {
     }
     
-    @Resource
-    public void setBus(Bus b) {
-        bus = b;
-    }
-    
     public void setApplicationContext(ApplicationContext arg0) throws BeansException {
-        context = arg0;    
+        context = arg0;  
+        try {
+            Class<?> cls = Class
+                .forName("org.springframework.context.annotation.CommonAnnotationBeanPostProcessor");
+            isProcessing = context.getBeanNamesForType(cls, true, false).length == 0;
+        } catch (ClassNotFoundException e) {
+            isProcessing = true;
+        }
     }
     
     public int getOrder() {
@@ -64,7 +64,7 @@
     }
         
     public Object postProcessAfterInitialization(Object bean, String beanId) throws BeansException
{
-        if (bus != null) {
+        if (!isProcessing) {
             return bean;
         }
         if (bean != null) {
@@ -82,7 +82,7 @@
     }
 
     public Object postProcessBeforeInitialization(Object bean, String beanId) throws BeansException
{
-        if (bus != null) {
+        if (!isProcessing) {
             return bean;
         }
         if (bean != null) {
@@ -92,7 +92,7 @@
     }
 
     public void postProcessBeforeDestruction(Object bean, String beanId) {
-        if (bus != null) {
+        if (!isProcessing) {
             return;
         }
         if (bean != null) {

Modified: cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml?rev=789704&r1=789703&r2=789704&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ cxf/trunk/rt/core/src/main/resources/META-INF/cxf/cxf.xml Tue Jun 30 13:13:33 2009
@@ -19,10 +19,15 @@
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:foo="http://cxf.apache.org/configuration/foo"
+       xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
 
+	<!--  For Testing using the Swing commons processor, uncomment one of: 
+	<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
+	<context:annotation-config/>
+	-->
     <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
     <bean id="org.apache.cxf.bus.spring.BusApplicationListener" class="org.apache.cxf.bus.spring.BusApplicationListener"/>
     <bean id="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor" class="org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor"/>



Mime
View raw message