Author: rmannibucau
Date: Sun Oct  9 15:51:32 2011
New Revision: 1180635

URL: http://svn.apache.org/viewvc?rev=1180635&view=rev
Log:
keeping only application with a default constructor

Modified:
    
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java

Modified: 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1180635&r1=1180634&r2=1180635&view=diff
==============================================================================
--- 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Sun Oct  9 15:51:32 2011
@@ -201,6 +201,7 @@ import java.beans.BeanInfo;
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -998,15 +999,24 @@ public class AnnotationDeployer implemen
                 webApp.getServlet().add(servlet);
             }
 
-            /*
-             * REST
-             */
+           /*
+                    * REST
+                    */
             // get by annotations
             webModule.getRestClasses().addAll(findRestClasses(webModule, 
finder));
-            // Applications
+            // Applications with a default constructor
             List<Class<? extends Application>> applications = 
finder.findSubclasses(Application.class);
             for (Class<? extends Application> app : applications) {
-                webModule.getRestApplications().add(app.getName());
+                if (app.getConstructors().length == 0) {
+                    webModule.getRestApplications().add(app.getName());
+                } else {
+                    for (Constructor<?> ctr : app.getConstructors()) {
+                        if (ctr.getParameterTypes().length == 0) {
+                            webModule.getRestApplications().add(app.getName());
+                            break;
+                        }
+                    }
+                }
             }
 
             return webModule;


Reply via email to