admin管理员组

文章数量:1399022

i´m working with spring-boot-starter-parent 3.3.4 and springdoc-openapi-starter-webmvc-ui 2.6.0

the endpoint for v3/api-docs works fine and return de definition but /swagger-ui.html and swagger-ui/index.html return 404.

Here is swagger config:

package com.example.demo.infraestructure.config;


import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import .springdoc.core.models.GroupedOpenApi;
import .springframework.context.annotation.Bean;
import .springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Price API")
                        .version("1.0")
                        .description("Price API")
                        .contact(new Contact()
                                .email("[email protected]").name("Sergio")));
    }
    @Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .group("public")
                .pathsToMatch("/**")
                .packagesToScan("com.example.demo")
                .build();
    }
}

and yml

# OpenAPI Configuration
springdoc:
  swagger-ui:
    enabled: true
    path: /swagger-ui.html
  api-docs:
    enabled: true
    path: /v3/api-docs
  packages-to-scan: com.example.demo

and some restcontroller anotations

@Operation(summary = "Find price by product ID, brand ID, and application date")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Found the price", content = {
            @Content(mediaType = "application/json", schema = @Schema(implementation = PriceResponse.class))}),
            @ApiResponse(responseCode = "404", description = "Price not found", content = @Content)})
    @GetMapping("/find")
    public ResponseEntity<PriceResponse> findPrice(
            @Parameter(description = "ID of the Product") @RequestParam Long productId,
            @Parameter(description = "Id of the Brand") @RequestParam Long brandId,
            @Parameter(description = "Application date") @RequestParam LocalDateTime applicationDate) {
        return ResponseEntity.ok(getPriceUseCase.getPrice(new PriceRequest(productId, brandId, applicationDate)));
    }

any idea what is happening??

thanks

本文标签: springv3apidocs works but swaggerui return 404Stack Overflow