Class SwaggerWebMVC

  • All Implemented Interfaces:
    org.springframework.web.servlet.config.annotation.WebMvcConfigurer

    @Configuration
    public class SwaggerWebMVC
    extends java.lang.Object
    implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
    The application turns off any automatic web page generate done by Spring. This is done to improve exception handling. However, we do need some web page generate done for Swagger, so we do that here.
    • Constructor Summary

      Constructors 
      Constructor Description
      SwaggerWebMVC()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addResourceHandlers​(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
      Adds the Swagger web pages to Spring.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer

        addArgumentResolvers, addCorsMappings, addFormatters, addInterceptors, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
    • Constructor Detail

      • SwaggerWebMVC

        public SwaggerWebMVC()
    • Method Detail

      • addResourceHandlers

        public void addResourceHandlers​(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
        Adds the Swagger web pages to Spring. This still gives the following warning

        No mapping for GET / No mapping for GET /csrf

        All works though

        Specified by:
        addResourceHandlers in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
        Parameters:
        registry - the place that holds the web pages for Spring