Search code examples
javaspring-bootspring-mvcswagger-ui

Swagger error Springboot Could not resolve view with name 'forward:/swagger-ui/index.html'


Springboot 2.5.13, swagger2: implementation "io.springfox:springfox-boot-starter:3.0.0" implementation "io.springfox:springfox-swagger-ui:3.0.0"

Runtime error: Could not resolve view with name 'forward:/swagger-ui/index.html'


Solution

  • The solution: create a bean like this:

      @Bean
      public InternalResourceViewResolver defaultViewResolver() {
        return new InternalResourceViewResolver();
      }
    

    source: https://github.com/springdoc/springdoc-openapi/issues/236