Gradle:
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.13'
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations', version: '2.2.7'
Properties:
springdoc.swagger-ui.enabled=true
springdoc.swagger-ui.path=/swagger-ui.html
Controller:
@RestController
@RequestMapping("/api/v1/cheque")
@FieldDefaults(level = AccessLevel.PRIVATE,makeFinal = true)
public class ChequeController {
ProductService productService;
public ChequeController(ProductService productService) {
this.productService = productService;
}
@GetMapping(value = "/get/{id}", produces = "application/json")
public Optional<Product> getByid(@PathVariable Long id) {
return productService.getById(id);
}
@GetMapping("/test")
public String test() {
return "test";
}
}
Conf:
@Configuration
public class OpenApiConfiguration {
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(
new Info()
.title("Example Swagger Api")
.version("1.0.0")
);
}
}
Trying to open in localhost:8080/swagger-ui.html
and getting:
Whitelabel Error Page There was an unexpected error (type=Not Found, status=404).
in https://springdoc.org/#getting-started saying, that it will automatically deploy swagger-ui to a spring-boot application
what im doing wrong