cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6121] Minor refactoring
Date Wed, 03 Dec 2014 15:19:01 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes e68a620a1 -> ea800588a


[CXF-6121] Minor refactoring


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ea800588
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ea800588
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ea800588

Branch: refs/heads/3.0.x-fixes
Commit: ea800588ade0031678b8da0e211cca52f54f3401
Parents: e68a620
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Dec 3 15:17:28 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Dec 3 15:18:40 2014 +0000

----------------------------------------------------------------------
 .../JAXRSServerFactoryBeanDefinitionParser.java | 27 +++++++-------------
 1 file changed, 9 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ea800588/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
index 8ed1310..b9a1ae3 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -231,28 +230,20 @@ public class JAXRSServerFactoryBeanDefinitionParser extends AbstractBeanDefiniti
                 } catch (ClassNotFoundException ex) {
                     throw new BeanCreationException("Failed to create bean from classfile",
ex);
                 }
-            } else if (serviceAnnotationClass != null) {
-                List<Object> services = new LinkedList<Object>();
-                List<Object> providers = new LinkedList<Object>();
-                for (Object obj : ctx.getBeansWithAnnotation(serviceAnnotationClass).values())
{
-                    Class<?> cls = obj.getClass();
-                    if (cls.getAnnotation(Path.class) != null) {
-                        services.add(obj);
-                    } else if (cls.getAnnotation(Provider.class) != null) {
-                        providers.add(obj);
-                    } 
-                }
-                this.setServiceBeans(services);
-                this.setProviders(providers);
-            } else if (!serviceBeansAvailable && !providerBeansAvailable &&
!resourceProvidersAvailable) {
-                AbstractSpringComponentScanServer scanServer = new AbstractSpringComponentScanServer()
{ };
-                scanServer.setApplicationContext(context);
-                scanServer.setJaxrsResources(this);
+            } else if (serviceAnnotationClass != null
+                || !serviceBeansAvailable && !providerBeansAvailable && !resourceProvidersAvailable)
{
+                discoverContextResources(serviceAnnotationClass);
             }
             if (bus == null) {
                 setBus(BusWiringBeanFactoryPostProcessor.addDefaultBus(ctx));
             }
         }        
+        private void discoverContextResources(Class<? extends Annotation> serviceAnnotationClass)
{
+            AbstractSpringComponentScanServer scanServer = 
+                new AbstractSpringComponentScanServer(serviceAnnotationClass) { };
+            scanServer.setApplicationContext(context);
+            scanServer.setJaxrsResources(this);
+        }
         @SuppressWarnings("unchecked")
         private Class<? extends Annotation> loadServiceAnnotationClass() {
             if (serviceAnnotation != null) {


Mime
View raw message