Dropwizard 0.8.0 WADL支持

hea*_*ach 2 wadl dropwizard jersey-2.0

可以在Dropwizard 0.7.1中配置Wadl,如下所示:

environment
        .jersey()
        .getResourceConfig()
        .getProperties()
        .put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.FALSE);//Create WADL
Run Code Online (Sandbox Code Playgroud)

如何在Dropwizard 0.8.0中设置它

con*_*dit 7

属性键的位置已更改且地图不可修改 - 因此您需要使用该addProperties方法:

import org.glassfish.jersey.server.ServerProperties;
...
Map<String, Object> properties = new HashMap<>();
properties.put(ServerProperties.WADL_FEATURE_DISABLE, false);
environment.jersey().getResourceConfig().addProperties(properties);
Run Code Online (Sandbox Code Playgroud)

从0.8.0开始,Dropwizard禁用WADL生成,因此您需要明确打开它.