Иго*_*нко 3 documentation spring-mvc spring-boot spring-restdocs
我有带有 spring-restdocs 的 spring-boot 应用程序,我想在该应用程序中为生成的文档创建端点。使用生成的 html 文档(由 asciidoctor)公开端点的最佳方法是什么?
我可以将 index.html 包含到 jar 文件中,但不知道如何创建将使用该 html 并暴露在外部的端点。此 html 在测试阶段之后和构建 jar 阶段之前生成。
来自官方文档:您可以将您创建的 HTML 文档发布到静态网站,或者将其打包并从应用程序本身提供。
例如,我在“build/asctiidoctor/html5”文件夹中有 index.html 并且想要创建将返回该 index.html 的控制器。
小智 10
根据文档,您可以配置您的构建系统(Maven、Gradle)以将 HTML 作为静态内容打包到 spring-boot jar 中,以便 Spring Boot“自动”提供服务
对于 Gradle 4.6 和 Spring Boot 2.0.0.RELEASE:
bootJar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
Run Code Online (Sandbox Code Playgroud)
然后可以通过本地验证 'localhost:<your-port>/<your-context-path/docs/index.html
| 归档时间: |
|
| 查看次数: |
1583 次 |
| 最近记录: |