Repository: cxf
Updated Branches:
  refs/heads/master 1f68d8488 -> 804a957eb


CXF-7095: CDI integration doesn't use the right bus to create the server factory


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

Branch: refs/heads/master
Commit: 804a957eb4225a1eaf65399881cdcd8552c00f52
Parents: 1f68d84
Author: reta <drr...@gmail.com>
Authored: Tue Oct 18 19:57:58 2016 -0400
Committer: reta <drr...@gmail.com>
Committed: Tue Oct 18 19:57:58 2016 -0400

----------------------------------------------------------------------
 .../org/apache/cxf/cdi/JAXRSCdiResourceExtension.java   |  6 ++----
 .../java/org/apache/cxf/jaxrs/utils/ResourceUtils.java  | 12 +++++++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/804a957e/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
----------------------------------------------------------------------
diff --git 
a/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
 
b/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
index fa81160..39baee5 100644
--- 
a/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
+++ 
b/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java
@@ -135,12 +135,11 @@ public class JAXRSCdiResourceExtension implements 
Extension {
     private JAXRSServerFactoryBean createFactoryInstance(final Application 
application, final List< ? > services,
             final List< ? > providers, final List< ? extends Feature > 
features) {
 
-        final JAXRSServerFactoryBean instance = 
ResourceUtils.createApplication(application, false, false);
+        final JAXRSServerFactoryBean instance = 
ResourceUtils.createApplication(application, false, false, bus);
         instance.setServiceBeans(new ArrayList<>(services));
         instance.setProviders(providers);
         instance.setProviders(loadExternalProviders());
         instance.setFeatures(features);
-        instance.setBus(bus);
 
         return instance;
     }
@@ -152,12 +151,11 @@ public class JAXRSCdiResourceExtension implements 
Extension {
      */
     private JAXRSServerFactoryBean createFactoryInstance(final Application 
application, final BeanManager beanManager) {
 
-        final JAXRSServerFactoryBean instance = 
ResourceUtils.createApplication(application, false, false);
+        final JAXRSServerFactoryBean instance = 
ResourceUtils.createApplication(application, false, false, bus);
         final Map< Class< ? >, List< Object > > classified = 
classes2singletons(application, beanManager);
         instance.setServiceBeans(classified.get(Path.class));
         instance.setProviders(classified.get(Provider.class));
         
instance.getFeatures().addAll(CastUtils.cast(classified.get(Feature.class), 
Feature.class));
-        instance.setBus(bus);
 
         return instance;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/804a957e/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
----------------------------------------------------------------------
diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
index afc759a..9cac0fb 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
@@ -810,9 +810,15 @@ public final class ResourceUtils {
     public static JAXRSServerFactoryBean createApplication(Application app, 
boolean ignoreAppPath) {
         return createApplication(app, ignoreAppPath, false);
     }
+    
+    public static JAXRSServerFactoryBean createApplication(Application app, 
boolean ignoreAppPath,
+            boolean staticSubresourceResolution) {
+        return createApplication(app, ignoreAppPath, 
staticSubresourceResolution, null);
+    }
+    
     @SuppressWarnings("unchecked")
     public static JAXRSServerFactoryBean createApplication(Application app, 
boolean ignoreAppPath,
-                                                           boolean 
staticSubresourceResolution) {
+            boolean staticSubresourceResolution, Bus bus) {
         
         Set<Object> singletons = app.getSingletons();
         verifySingletons(singletons);
@@ -850,6 +856,10 @@ public final class ResourceUtils {
         }
         
         JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
+        if (bus != null) {
+            bean.setBus(bus);
+        }
+
         String address = "/";
         if (!ignoreAppPath) {
             ApplicationPath appPath = locateApplicationPath(app.getClass());

Reply via email to