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
版权声明:本文标题:spring - v3api-docs works but swagger-ui return 404 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744125369a2591930.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论