Skip to content

Commit 268a18b

Browse files
authored
Merge pull request #2974 from nelsongraca/master
Fix for Issue #2966
2 parents 3295a10 + ee0ab2d commit 268a18b

File tree

1 file changed

+7
-1
lines changed
  • modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2

1 file changed

+7
-1
lines changed

modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/Reader.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ public OpenAPI read(Set<Class<?>> classes, Map<String, Object> resources) {
198198

199199
protected String resolveApplicationPath() {
200200
if (application != null) {
201-
ApplicationPath applicationPath = application.getClass().getAnnotation(ApplicationPath.class);
201+
Class<?> applicationToScan = this.application.getClass();
202+
ApplicationPath applicationPath;
203+
//search up in the hierarchy until we find one with the annotation, this is needed because for example Weld proxies will not have the annotation and the right class will be the superClass
204+
while ((applicationPath = applicationToScan.getAnnotation(ApplicationPath.class)) == null && !applicationToScan.getSuperclass().equals(Application.class)) {
205+
applicationToScan = applicationToScan.getSuperclass();
206+
}
207+
202208
if (applicationPath != null) {
203209
if (StringUtils.isNotBlank(applicationPath.value())) {
204210
return applicationPath.value();

0 commit comments

Comments
 (0)