springdoc-openapi icon indicating copy to clipboard operation
springdoc-openapi copied to clipboard

springdoc-openapi-starter-webmvc-ui encounters a 404 error when accessing swagger-ui/index.html

Open a1576471428 opened this issue 2 years ago • 3 comments

Describe the bug

The latest version (2.5.0) of springdoc-openapi-starter-webmvc-ui encounters a 404 error when accessing swagger-ui/index.html

To Reproduce import maven:

            <dependency>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
                <version>2.5.0</version>
            </dependency>

then access http://localhost:8080/swagger-ui/index.html

Expected behavior got swagger ui

Screenshots image

Additional context

i found the swagger-ui version in pom is 5.13.0, but in config file springdoc.config.properties is 5.2.0

a1576471428 avatar May 29 '24 05:05 a1576471428

I have met same issue. Any help would be greatly appreciated.

smallyao avatar May 29 '24 08:05 smallyao

I have met same issue. Any help would be greatly appreciated.

Check your dependencies. In my case, the springdoc-openapi-starter-common version indirectly introduced by other dependencies does not match the corresponding swagger-ui version. You can check whether the swagger-ui version declared in springdoc.config.properties under the springdoc-openapi-starter-common package is consistent with the actual one introduced.

a1576471428 avatar May 29 '24 13:05 a1576471428

Facing the same issue [springdoc v.2.6.0]. swagger ui and springdoc.config.properties are both in 5.13.0 version. my versions : springboot 3.3.2 jdk 21

no problem to access to http://localhost:9000/v0/v3/api-docs but http://localhost:9000/v0/swagger-ui/index.html throws me an 500 error : { "message": "No endpoint GET /v0/swagger-ui/index.html.", "status": 500 }

To reproduce :

application-dev.yml :

server: port: 9000 servlet: context-path: /v0

SpringSecurityConfig :

http.csrf(AbstractHttpConfigurer::disable)
                .formLogin(AbstractHttpConfigurer::disable)
                .httpBasic(AbstractHttpConfigurer::disable)
                .authenticationManager(authenticationManager)
                .securityContext(httpSecuritySecurityContextConfigurer -> httpSecuritySecurityContextConfigurer.securityContextRepository(securityContextRepository))
                .exceptionHandling(exceptionHandlingSpec -> exceptionHandlingSpec.authenticationEntryPoint(simpleAuthenticationEntryPoint))
                .authorizeHttpRequests(authorizationManagerRequestMatcherRegistry -> authorizationManagerRequestMatcherRegistry.requestMatchers(HttpMethod.OPTIONS).permitAll()
                        .requestMatchers(HttpMethod.GET, "/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/v0/webjars/**", 
                         "/webjars/**", "/swagger-resources/**", "/actuator/**").permitAll()
                        .anyRequest().authenticated()).build();

Thanks for your help !

GuillaumeMartial avatar Aug 22 '24 08:08 GuillaumeMartial