当前位置: 首页 > 知识库问答 >
问题:

如何在HTTPS中使用springdoc-openapi-maven-plugin

公孙森
2023-03-14
[ERROR] An error has occurred
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path 
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find 
valid certification path to requested target

pom.xml

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>2.3.0.RELEASE</version>
            <executions>
                <execution>
                    <id>pre-integration-test</id>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>post-integration-test</id>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-maven-plugin</artifactId>
            <version>1.0</version>
            <executions>
                <execution>
                    <id>integration-test</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <apiDocsUrl>https://localhost:8444/v3/api-docs</apiDocsUrl>
            </configuration>
        </plugin>

共有1个答案

经嘉
2023-03-14

这与您的本地SSL配置有关。以下是一些小贴士:

>

  • 确保已将证书导入JDK TruStore。

    JDK trustore应该与Maven使用的相同。

  •  类似资料:
    • 我试图在OpenAPI 3.0规范中创建一个响应链接。更具体地说,我想提供我的一个响应和其他可用操作之间的已知关系(参见。链接对象)。 在我的SpringBoot项目中,我使用Springdoc(版本:1.3.9)生成API文档。根据@ApiResponse#links文档,我已尝试使用以下endpoint代码实现我的目标: 不幸的是,我看不到任何结果在招摇过市的用户界面,但“没有链接”的描述。

    • springdoc-openapi库自动标记生成的OpenAPI文档中所需的某些属性。例如,注释为的属性将包括在生成的YAML文件中所需的属性列表中。 库不做的一件事是将可选属性标记为。但是,默认情况下,Spring Boot应用程序将在请求中接受,并在可选属性的响应中返回。这意味着OpenAPI文档和endpoint行为之间存在差异。 在SpringDoc-OpenAPI生成的OpenAPI文档

    • 当我发布时,我会使用HTTPS请求而不是HTTP,但是swagger原始URL仍然是HTTP,我不知道如何设置它,并且在原始springdoc-openapi-用户界面配置中没有为服务器留档

    • 我的目标是使用OpenAPI3.0生成Spring Boot REST客户端。 我希望首先生成API的OpenAPI规范文件(springdoc-openapi-maven-plugin),然后使用Maven从该文件(swagger-codegen-maven-plugin)生成客户机代码。 我的问题是swagger-codegen-maven-plugin在springdoc-openapi-m

    • 我正在使用版本为(1.2.32)的SpringDocOpenAPI。现在,我想在UI中按HTTP方法(反向顺序)对endpoint进行排序,并且我没有在endpoint方法上使用任何标记。 如果我有4个endpoint发布,获取,放置,删除,然后我想显示方法放置,发布,获取,删除 我尝试了以下方法,但似乎不起作用: springdoc.swagger-ui.operations排序器=(方法和al

    • 我试图在maven构建期间生成swagger.json文件。 这是我在pom.xml中从docs获得的插件。 任何帮助都将不胜感激。