You need to enable JavaScript to run this app. 使用springdoc-openapi时如何禁用swagger文档自动生成的WADL端点
优惠活动
大模型
产品
解决方案
定价
更多

使用springdoc-openapi时如何禁用swagger文档自动生成的WADL端点

禁用Spring Boot自动生成的/application.wadl端点方案

首先明确:/application.wadl是JAX-RS实现(Jersey)默认开启的接口描述端点,和springdoc-openapi没有直接关联,是项目引入Jersey相关依赖后触发的默认行为,可通过以下两种方式禁用:

方案1:配置文件直接关闭(推荐)

在application.yml中添加如下配置即可:

spring:
  jersey:
    wadl:
      enabled: false

如果你使用的是application.properties,对应配置为:

spring.jersey.wadl.enabled=false

配置完成后重启应用,该端点将直接返回404。

方案2:Jersey配置类硬编码关闭

如果你通过自定义ResourceConfig类管理Jersey配置,可以在类中直接关闭WADL生成特性:

import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomJerseyConfig extends ResourceConfig {
    public CustomJerseyConfig() {
        // 禁用WADL生成逻辑
        property(ServerProperties.WADL_FEATURE_DISABLE, true);
        // 其他原有Jersey配置保留即可
        packages("com.your.business.package");
    }
}

如果以上配置均不生效,可检查项目是否存在其他第三方依赖强制开启了WADL特性,排查对应配置即可。

内容的提问来源于stack exchange,提问作者ark

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.20 16:27:03