You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/08/09 22:35:33 UTC

svn commit: r1371462 - in /cxf/branches/2.4.x-fixes: rt/core/src/main/java/org/apache/cxf/bus/spring/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/resources/jaxrs/WEB-INF/

Author: dkulp
Date: Thu Aug  9 20:35:33 2012
New Revision: 1371462

URL: http://svn.apache.org/viewvc?rev=1371462&view=rev
Log:
Merged revisions 1366434 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1366434 | sergeyb | 2012-07-27 12:15:00 -0400 (Fri, 27 Jul 2012) | 16 lines

  Merged revisions 1366433 via svnmerge from
  https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

  ................
    r1366433 | sergeyb | 2012-07-27 17:09:56 +0100 (Fri, 27 Jul 2012) | 9 lines

    Merged revisions 1366432 via svnmerge from
    https://svn.apache.org/repos/asf/cxf/trunk

    ........
      r1366432 | sergeyb | 2012-07-27 17:05:59 +0100 (Fri, 27 Jul 2012) | 1 line

      [CXF-4444] Updating BusApplicationContextResourceResolver to resolve resources without names by their types only, as proposed by Matas Veitas
    ........
  ................

........

Modified:
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
    cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java?rev=1371462&r1=1371461&r2=1371462&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java Thu Aug  9 20:35:33 2012
@@ -65,11 +65,15 @@ public class BusApplicationContextResour
     }
 
     public <T> T resolve(String resourceName, Class<T> resourceType) {
-        if (resourceName == null) {
-            return null;
-        }   
+           
         try {
-            return resourceType.cast(context.getBean(resourceName, resourceType));
+            T resource = null;
+            if (resourceName == null) {
+                resource = resourceType.cast(context.getBean(resourceType));
+            } else {
+                resource = resourceType.cast(context.getBean(resourceName, resourceType));
+            }
+            return resource;
         } catch (NoSuchBeanDefinitionException def) {
             //ignore
         }

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java?rev=1371462&r1=1371461&r2=1371462&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java (original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSpring.java Thu Aug  9 20:35:33 2012
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.MatrixParam;
@@ -57,6 +58,8 @@ public class BookStoreSpring {
     @Context
     private UriInfo ui;    
     private boolean postConstructCalled;
+    @Resource
+    private Book injectedBook; 
     
     public BookStoreSpring() {
         init();
@@ -66,6 +69,9 @@ public class BookStoreSpring {
     
     @PostConstruct
     public void postConstruct() {
+        if (injectedBook == null) {
+            throw new IllegalStateException("Book resource has not been injected");
+        }    
         postConstructCalled = true;
     }
     

Modified: cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?rev=1371462&r1=1371461&r2=1371462&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml (original)
+++ cxf/branches/2.4.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml Thu Aug  9 20:35:33 2012
@@ -43,6 +43,7 @@ http://cxf.apache.org/schemas/core.xsd">
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 
   <bean class="org.apache.cxf.systest.jaxrs.BookStoreSpring" id="serviceBean"/>
+  <bean class="org.apache.cxf.systest.jaxrs.Book"/>
   
   <jaxrs:server id="bookservice"
 		        address="/bookstore">