Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 7c3ce3d49 -> b428f2435


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/b428f243
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b428f243
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b428f243

Branch: refs/heads/3.1.x-fixes
Commit: b428f24357086ea472b83d092ab40966fb692d7d
Parents: 7c3ce3d
Author: reta <drr...@gmail.com>
Authored: Tue Oct 18 19:57:58 2016 -0400
Committer: reta <drr...@gmail.com>
Committed: Tue Oct 18 20:04:13 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/b428f243/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 ba69f15..bb397c2 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
@@ -132,12 +132,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;
     }
@@ -149,12 +148,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 = 
classifySingletons(application, beanManager);
         instance.setServiceBeans(classified.get(Path.class));
         instance.setProviders(classified.get(Provider.class));
         instance.setFeatures(CastUtils.cast(classified.get(Feature.class), 
Feature.class));
-        instance.setBus(bus);
 
         return instance;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b428f243/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