Java Code Examples for springfox.documentation.spring.web.plugins.Docket#host()

The following examples show how to use springfox.documentation.spring.web.plugins.Docket#host() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwaggerConfiguration.java    From hesperides with GNU General Public License v3.0 6 votes vote down vote up
@Bean
public Docket productApi() throws URISyntaxException {
    Docket docket = new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("org.hesperides.core.presentation"))
            .paths(any())
            .build();

    if (StringUtils.isNotEmpty(host)) {
        URI uri = new URI(host);
        docket.host(uri.getAuthority());
        docket.protocols(Sets.newHashSet(uri.getScheme()));
    }

    return docket;
}
 
Example 2
Source File: SwaggerConfig.java    From dk-foundation with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Bean
@RefreshScope
public Docket customDocket() {
    Docket docket = new Docket(DocumentationType.SWAGGER_2).select()
            .apis(RequestHandlerSelectors.basePackage(basePackage))
            .paths(Predicates.not(PathSelectors.regex("/error.*")))
            .build()
            .apiInfo(apiInfo())
            .enable(enable);
    if(!host.equals(HOST_NONE)){
        docket.host(host);
    }
    return docket;
}