Improve auto-detection of Spring beans.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 26 Jun 2008 16:52:08 +0000 (16:52 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 26 Jun 2008 16:52:08 +0000 (16:52 +0000)
Make WS communications more robust

git-svn-id: https://svn.argeo.org/slc/trunk@1292 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.core/src/main/java/org/argeo/slc/spring/SpringUtils.java

index cbc5c6abfc21e60eaeb076e27ae0e9f6c668fd04..e31dbcc59670f1e3ab6e503c34ca67acf71b4bca 100644 (file)
@@ -8,6 +8,8 @@ import java.util.Map;
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
 import org.argeo.slc.core.SlcException;\r
+import org.springframework.beans.BeanUtils;\r
+import org.springframework.beans.factory.BeanFactoryUtils;\r
 import org.springframework.beans.factory.ListableBeanFactory;\r
 import org.springframework.core.io.DefaultResourceLoader;\r
 import org.springframework.core.io.Resource;\r
@@ -17,7 +19,9 @@ public class SpringUtils {
 \r
        public static <T> T loadSingleFromContext(ListableBeanFactory context,\r
                        Class<T> clss) {\r
-               Map<String, T> beans = context.getBeansOfType(clss);\r
+               // Map<String, T> beans = context.getBeansOfType(clss);\r
+               Map<String, T> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(\r
+                               context, clss);\r
                if (beans.size() == 1) {\r
                        return beans.values().iterator().next();\r
                } else {\r