All Downloads are FREE. Search and download functionalities are using the official Maven repository.

handlebars.JavaSpring.libraries.spring-boot.swaggerUiConfiguration.mustache Maven / Gradle / Ivy

There is a newer version: 1.0.54
Show newest version
package {{configPackage}};

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

{{>generatedAnnotation}}
@Configuration
public class SwaggerUiConfiguration implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        {{#useOas2}}
        registry
            .addResourceHandler("/swagger-ui.html")
            .addResourceLocations("classpath:/META-INF/resources/");
 
        registry
            .addResourceHandler("/webjars/**")
            .addResourceLocations("classpath:/META-INF/resources/webjars/");
        {{/useOas2}}
        {{^useOas2}}
        registry.
            addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
                .resourceChain(false);
        {{/useOas2}}
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        {{^useOas2}}
        registry.addViewController("/swagger-ui/").setViewName("forward:/swagger-ui/index.html");
        {{/useOas2}}
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy