Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 12f8355

Browse files
author
Constantino Cronemberger
committed
Make the method really search for the @path annotation in the ancestor hierarchy. Without this fix it is not possible to register proxied beans created by Spring because the annotation is in the super class
1 parent 79c0bcb commit 12f8355

File tree

1 file changed

+13
-7
lines changed
  • core-server/src/main/java/org/glassfish/jersey/server/model/internal

1 file changed

+13
-7
lines changed

core-server/src/main/java/org/glassfish/jersey/server/model/internal/ModelHelper.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
* Common model helper methods.
4747
*
4848
* @author Michal Gajdos (michal.gajdos at oracle.com)
49+
* @author Constantino Cronemberger (cocr at gft.com)
4950
*/
5051
public final class ModelHelper {
5152

@@ -58,15 +59,20 @@ public final class ModelHelper {
5859
* annotation.
5960
*/
6061
public static Class<?> getAnnotatedResourceClass(Class<?> resourceClass) {
61-
if (resourceClass.isAnnotationPresent(Path.class)) {
62-
return resourceClass;
63-
}
6462

65-
for (Class<?> i : resourceClass.getInterfaces()) {
66-
if (i.isAnnotationPresent(Path.class)) {
67-
return i;
63+
// traverse the class hierarchy to find the annotation
64+
Class<?> cls = resourceClass;
65+
do {
66+
if (cls.isAnnotationPresent(Path.class)) {
67+
return cls;
6868
}
69-
}
69+
70+
for (Class<?> i : cls.getInterfaces()) {
71+
if (i.isAnnotationPresent(Path.class)) {
72+
return i;
73+
}
74+
}
75+
} while ((cls = cls.getSuperclass()) != null);
7076

7177
return resourceClass;
7278
}

0 commit comments

Comments
 (0)