fix:修复springboot项目配置server.servlet.context-path 时,swagger访问资源404问题

This commit is contained in:
taogang
2023-07-13 20:07:57 +08:00
parent 0df946efe8
commit 0b256d16ec

View File

@@ -87,7 +87,7 @@ public class MagicSpringDocConfiguration implements MagicPluginConfiguration {
} else {
urls = new HashSet<>(urls);
}
urls.add(new SwaggerUrl(springDocConfig.getGroupName(), springDocConfig.getLocation(), null));
urls.add(new SwaggerUrl(springDocConfig.getGroupName(), servletContext.getContextPath() + springDocConfig.getLocation(), null));
params.put("urls", urls);
return params;
}